Facebook Login – Swift Language – iOS 10 – Swift 3

Facebook Login using custom button in Swift Language

Xcode Version 8

Article is Updated with the Facebook 4.16 SDK [27-September-2016].

facebook-logo

Install Pods

Appdelegate.swift

ViewController.swift

Create touch up inside event for custom button like as follows

In iOS 10 don’t forget to set capabilities (Keychain Sharing) :

Go to your project targets -> Capabilities -> Keychain Sharing -> Toggle Switch ON

Capabilities - KeyChain Sharing
Capabilities – KeyChain Sharing

Detailed Output Log :

Happy Coding 😀

How to work with WatchKit in Swift Language – iOS 8 #Tutorial #CounterWithWatch

Apple Watch represents a new chapter in the relationship people have with technology. Now you can deliver innovative new experiences to your customers on their wrist. And by adding WatchKit, you can take your apps even further by extending and enhancing their functionality on Apple Watch.

Lets learn how to work with WatchKit by an Counter Example.

Counter Watch Example
Counter Watch

Create New Project in XCode with Swift Language

New Project
New Project

Add Apple Watch Target in your Application

Add Target
Add Target

Select Apple Watch Target

Add Target Apple Watch
Add Target Apple Watch

Select Options for Target

Target Options
Target Options

Storyborad of watch

By adding target you will find the InterfaceController.swift and Interface.storyboard

Storyboard And Swift Files
Storyboard And Swift Files

Design watch with the controls

Design and reposition the controls with the properties of controls.

Design Controls in Watch
Design Controls in Watch

Now Time to do some code and connect the outlets

Connect Outlets
Connect Outlets

Code:

//  InterfaceController.swift

import WatchKit
import Foundation


class InterfaceController: WKInterfaceController {

    @IBOutlet weak var lblCounter: WKInterfaceLabel!
    var counter:Int = 0

    override func awakeWithContext(context: AnyObject?) {
        super.awakeWithContext(context)
        
        // Configure interface objects here.
    }

    override func willActivate() {
        // This method is called when watch view controller is about to be visible to user
        super.willActivate()
    }

    override func didDeactivate() {
        // This method is called when watch view controller is no longer visible
        super.didDeactivate()
    }
    
    @IBAction func upButtonPressed() {
        counter = counter + 1
        lblCounter.setText("\(counter)")
    }
    
    @IBAction func downButtonPressed() {
        counter = counter - 1
        lblCounter.setText("\(counter)")
    }
}

Download project with this stuff AppleWatchCounterDemo.zip

Thanks!

Happy Coding 😀