NRLoginManager: This library provides makes your login work easy by integrating the facebook and google login with one line of code.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Xcode 9+ , Swift 4 , iOS 10 and above
NRLoginManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "NRLoginManager"
@IBAction func facebookButtonPressed(_ sender: UIButton) {
NRLoginManager.shared.login(type: .facebook) { (user, error) in
if error == nil {
self.welcomeLabel.text = user!.name
print(user!)
}
}
}
@IBAction func googleButtonPressed(_ sender: UIButton) {
NRLoginManager.shared.clientID = "YOUR GOOGLE CLIENT ID" https://developers.google.com/identity/sign-in/ios/start-integrating
NRLoginManager.shared.login(type: .google) { (user, error) in
if error == nil {
self.welcomeLabel.text = user!.name
print(user!)
}
}
}
You have to update the plist with your social ids.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fbYOURFBID</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>Add google client id here</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>FacebookAppID</key>
<string>YOURFBID</string>
<key>FacebookDisplayName</key>
<string>NRLoginManager</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>comgooglemaps</string>
</array>
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
NRLoginManager.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return NRLoginManager.shared.application(app, open: url, options: options)
}
Contributions are always welcome! :)
- Fork it ( http://github.com/naveenrana1309/NRLoginManager/fork )
- Create your feature branch ('git checkout -b my-new-feature')
- Commit your changes ('git commit -am 'Add some feature')
- Push to the branch ('git push origin my-new-feature')
- Create new Pull Request
Xcode 9+ , Swift 4 , iOS 10 and above
Naveen Rana. See Profile
Email: naveenrana1309@gmail.com.
Check out Facebook Profile for detail.
NRLoginManager is available under the MIT license. See the LICENSE file for more info.