/NXSSocialManagers

Sample App for Social Managers (Facebook Login, Google Login, Apple SignIn) in Swift Language

Primary LanguageSwift

NXSSocialManagers

Sample App for Social Managers (Facebook Login, Google Login) in Swift Language

Getting Started

Prerequisites

Facebook

Add the following to your Podfile and run pod install.

pod 'FBSDKLoginKit'
pod 'FBSDKCoreKit'
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        NXSFbManager.shared.initilize(application: application, launchOptions: launchOptions)
        return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        if NXSFbManager.shared.application(app, open: url, options: options) {
            return true
        }
        return false
}
private func facebookLogin() {
        NXSFbManager.shared.login(viewController: self) { (socialUserInfo, message, success) in
            if !success {
                //Show Toast or Alert
                print(message ?? "Facebook Login Error")
            } else {
                if let userInfo = socialUserInfo {
                    print("User Info -> Id :: \(userInfo.userId)")
                }
            }
        }
}
private func facebookLogout() {
        NXSFbManager.shared.logout()
}

Google

Add the following to your Podfile and run pod install.

pod 'GoogleSignIn'
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        NXSGoogleManager.shared.initilize()
        return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        if NXSGoogleManager.shared.application(app, open: url, options: options) {
            return true
        }
        return false
}
private func googleLogin() {
        NXSGoogleManager.shared.login(viewController: self) { (socialUserInfo, message, success) in
            if !success {
                //Show Toast or Alert
                print(message ?? "Google Login Error")
            } else {
                if let userInfo = socialUserInfo {
                    print("User Info -> Id :: \(userInfo.userId)")
                }
            }
        }
}
private func googleLogout() {
        NXSGoogleManager.shared.logout()
}