Skip to content

The WeCards Sign-In iOS quickstart demonstrates how to authenticate people with their WeCards credentials.

License

Notifications You must be signed in to change notification settings

patelnirav48/WeCards

Repository files navigation

WeCards

The WeCards Sign-In iOS quick start demonstrates how to authenticate people with their WeCards credentials.

Requirements

iOS 8.0+ / macOS 10.13+
Xcode 10.0+
Swift 4.2+

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate WeCards Sign-In into your Xcode project using Carthage, specify it in your Cartfile:

github "patelnirav48/WeCards" ~> 1.0

Run carthage update to build the framework and drag the built WeCardsSignIn.framework into your Xcode project.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate WeCards Sign-In into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
   pod 'WeCardsSignIn', :path => '../'
   pod 'Alamofire', '~> 4.7'
end

Then, run the following command:

$ pod install

.plist Entries

In order for your app to signin with WeCards, you'll need to ad these plist entries:

<key>WeCardsAppID</key>
<string>#WECARDS_APP_ID#</string>
<key>LSApplicationQueriesSchemes</key>
<array>
	<string>wecards</string>
</array>
<key>CFBundleURLTypes</key>
<array>
	<dict>
		<key>CFBundleURLName</key>
		<string>#BUNDLE_IDENTIFIER#</string>
		<key>CFBundleURLSchemes</key>
		<array>
			<string>wecards#WECARDS_APP_ID#</string>
		</array>
	</dict>
</array>

Configurations

In your App Delegate,

import WeCardsSignIn
   
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return WCSignIn.sharedInstance().application(app, open: url, options: options)
}

In your View Controller,

To initiate, add the following code to an appropriate view controller:

import WeCardsSignIn

class ViewController: UIViewController, WeCardsSignInDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    
        WCSignIn.sharedInstance().delegate = self
        WCSignIn.sharedInstance().presentViewController(viewController: self)
    }
}

When the authentication is complete, you will get a callback via the WeCardsSignInDelegate protocol:

func onAuthenticationSuccessful(dictionary: NSDictionary) {
    print("Successful Authentication!")
}

func onAuthenticationFail(message: String) {
    print("Authentication Failed!")
}

func onSignOutSuccessful(dictionary: NSDictionary) {
    print("Signout successfully")
}

About

The WeCards Sign-In iOS quickstart demonstrates how to authenticate people with their WeCards credentials.

Resources

License

Stars

Watchers

Forks

Packages

No packages published