LoginKit is a quick and easy way to add Facebook and email Login/Signup UI to your app.

Overview

LoginKit

Version License Platform Made with Love by Icalia Labs

About

LoginKit is a quick and easy way to add Facebook and email Login/Signup UI to your app. If you need to quickly prototype an app, create an MVP or finish an app for a hackathon, LoginKit can help you by letting you focus on what makes your app special and leave login/signup to LoginKit. But if what you really want is a really specific and customized login/singup flow you are probably better off creating it on your own.

LoginKit handles Signup & Login, via Facebook & Email. It takes care of the UI, the forms, validation, and Facebook SDK access. All you need to do is start LoginKit, and then make the necessary calls to your own backend API to login or signup.

This is a simple example of how your login can look. Check out the example project to see how this was done and tinker around with it.

This other example is LoginKit in use in one of our client apps.

What's New

v.1.0.0

  • Ability to use LoginViewController, SignupViewController and PasswordViewController on it's own without having to use the LoginCoordinator
  • Ability to hide Login, Signup and Facebook buttons in initial screen
  • Added ability to remove background gradient
  • Added ability to remove animation when starting the Login Coordinator
  • Fixed an issue with the keyboard mover not working in some cases
  • Fixes/Improvements to the sample project
  • Updated Facebook SDK to latest version

Requirements

Installation

LoginKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ILLoginKit"

Getting Started

Login Coordinator

Everything is handled through the LoginCoordinator class. You instantiate it and pass the root view controller which is the UIViewController from which the LoginKit process will be started (presented) on. This will usually be self.

import LoginKit

class ViewController: UIViewController { 

    lazy var loginCoordinator: LoginCoordinator = {
        return LoginCoordinator(rootViewController: self)
    }()
    
    ...

    func showLogin() {
        loginCoordinator.start()
    }
    
    ...

}

Afterwards call start on the coordinator. That's it!

Customization

Of course you will want to customize the Login Coordinator to be able to supply your own UI personalization, and to perform the necessary actions on login or signup.

That is done by subclassing the LoginCoordinator class.

class LoginCoordinator: ILLoginKit.LoginCoordinator {

}

Start

Handle anything you want to happen when LoginKit starts. Make sure to call super.

override func start(animated: Bool = true) {
    super.start(animated: animated)
    configureAppearance()
}

Configuration

You can set any of these properties on the configuration property of the superclass to change the way LoginKit looks. Besides the images, all other properties have defaults, no need to set them if you don't need them.

Property Effect
backgroundImage The background image that will be used in all ViewController's.
backgroundImageGradient Set to false to remove the gradient from the background image. (Default is true)
mainLogoImage A logo image that will be used in the initial ViewController.
secondaryLogoImage A smaller logo image that will be used on all ViewController's except the initial one.
tintColor The tint color for the button text and background color.
errorTintColor The tint color for error texts.
loginButtonText The text for the login button.
signupButtonText The text for the signup button.
facebookButtonText The text for the facebook button.
forgotPasswordButtonText The text for the forgot password button.
recoverPasswordButtonText The text for the recover password button.
namePlaceholder The placeholder that will be used in the name text field.
emailPlaceholder The placeholder that will be used in the email text field.
passwordPlaceholder The placeholder that will be used in the password text field.
repeatPasswordPlaceholder The placeholder that will be used in the repeat password text field.
shouldShowSignupButton To hide the signup button set to false. (Default is true)
shouldShowLoginButton To hide the login button set to false. (Default is true)
shouldShowFacebookButton To hide the Facebook button set to false. (Default is true)
shouldShowForgotPassword To hide the forgot password button set to false. (Default is true)
// Customize LoginKit. All properties have defaults, only set the ones you want.
func configureAppearance() {
    // Customize the look with background & logo images
    configuration.backgroundImage = 
    configuration.mainLogoImage =
    configuration.secondaryLogoImage =

    // Change colors
    configuration.tintColor = UIColor(red: 52.0/255.0, green: 152.0/255.0, blue: 219.0/255.0, alpha: 1)
    configuration.errorTintColor = UIColor(red: 253.0/255.0, green: 227.0/255.0, blue: 167.0/255.0, alpha: 1)

    // Change placeholder & button texts, useful for different marketing style or language.
    configuration.loginButtonText = "Sign In"
    configuration.signupButtonText = "Create Account"
    configuration.facebookButtonText = "Login with Facebook"
    configuration.forgotPasswordButtonText = "Forgot password?"
    configuration.recoverPasswordButtonText = "Recover"
    configuration.namePlaceholder = "Name"
    configuration.emailPlaceholder = "E-Mail"
    configuration.passwordPlaceholder = "Password!"
    configuration.repeatPasswordPlaceholder = "Confirm password!"
}

You can also create your own type that conforms to the ConfigurationSource protocol, or use the DefaultConfiguration struct. Then just set it on the configuration object like so.

configuration = DefaultConfiguration(backgroundImage: signupButtonText: "Create Account",
					 loginButtonText: "Sign In",
					 facebookButtonText: "Login with Facebook",
					 forgotPasswordButtonText: "Forgot password?",
					 recoverPasswordButtonText: "Recover",
					 emailPlaceholder: "E-Mail",
					 passwordPlaceholder: "Password!",
					 repeatPasswordPlaceholder: "Confirm password!",
					 namePlaceholder: "Name",
					 shouldShowSignupButton: false,
					 shouldShowLoginButton: true,
					 shouldShowFacebookButton: false,
					 shouldShowForgotPassword: true)x

Completion Callbacks

Override these other 4 callback methods to handle what happens after the user tries to login, signup, recover password or enter with facebook.

Here you would call your own API.

// Handle login via your API
override func login(email: String, password: String) {
    print("Login with: email =\(email) password = \(password)")
}

// Handle signup via your API
override func signup(name: String, email: String, password: String) {
    print("Signup with: name = \(name) email =\(email) password = \(password)")
}

// Handle Facebook login/signup via your API
override func enterWithFacebook(profile: FacebookProfile) {
    print("Login/Signup via Facebook with: FB profile =\(profile)")
}

// Handle password recovery via your API
override func recoverPassword(email: String) {
    print("Recover password with: email =\(email)")
}

Finish

After successfull login call the finish() method on LoginCoordinator. Be sure to call super.

override func finish(animated: Bool = true) {
    super.finish(animated: animated)
}

Code

The final result would look something like this.

import Foundation
import ILLoginKit

class LoginCoordinator: ILLoginKit.LoginCoordinator {

    // MARK: - LoginCoordinator

    override func start(animated: Bool = true) {
        super.start(animated: animated)
        configureAppearance()
    }

    override func finish(animated: Bool = true) {
        super.finish(animated: animated)
    }

    // MARK: - Setup

    // Customize LoginKit. All properties have defaults, only set the ones you want.
    func configureAppearance() {
        // Customize the look with background & logo images
        configuration.backgroundImage = #imageLiteral(resourceName: "Background")
        // mainLogoImage =
        // secondaryLogoImage =

        // Change colors
        configuration.tintColor = UIColor(red: 52.0/255.0, green: 152.0/255.0, blue: 219.0/255.0, alpha: 1)
        configuration.errorTintColor = UIColor(red: 253.0/255.0, green: 227.0/255.0, blue: 167.0/255.0, alpha: 1)

        // Change placeholder & button texts, useful for different marketing style or language.
        configuration.loginButtonText = "Sign In"
        configuration.signupButtonText = "Create Account"
        configuration.facebookButtonText = "Login with Facebook"
        configuration.forgotPasswordButtonText = "Forgot password?"
        configuration.recoverPasswordButtonText = "Recover"
        configuration.namePlaceholder = "Name"
        configuration.emailPlaceholder = "E-Mail"
        configuration.passwordPlaceholder = "Password!"
        configuration.repeatPasswordPlaceholder = "Confirm password!"
    }

    // MARK: - Completion Callbacks

    // Handle login via your API
    override func login(email: String, password: String) {
        print("Login with: email =\(email) password = \(password)")
    }
    
    // Handle signup via your API
    override func signup(name: String, email: String, password: String) {
        print("Signup with: name = \(name) email =\(email) password = \(password)")
    }

    // Handle Facebook login/signup via your API
    override func enterWithFacebook(profile: FacebookProfile) {
        print("Login/Signup via Facebook with: FB profile =\(profile)")
    }

    // Handle password recovery via your API
    override func recoverPassword(email: String) {
        print("Recover password with: email =\(email)")
    }

}

Using the ViewController's without the LoginCoordinator

If you only need to use the LoginViewController or SignupViewController or PasswordViewController on it's own, without using the LoginCoordinator, now you can.

Just subclass any of them, and set configuration property in the viewDidLoad() method before calling super.viewDidLoad().

class OverridenLoginViewController: LoginViewController {

    override func viewDidLoad() {
	configuration = Settings.defaultLoginConfig // configure before calling super
	super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

}

Then just present the ViewController, and set the delegate property to receive the appropiate callbacks for that controller.

Author

Daniel Lozano, [email protected]

License

LoginKit is available under the MIT license. See the LICENSE file for more info.

Comments
  • Ios 11 closing view cause crash

    Ios 11 closing view cause crash

    hi, closing all view make the app crash

    the view are nulled on close and if i try to open again the view it crash (nulled view)

    i need to comment all navigationController = nil initialViewController = nil loginViewController = nil signupViewController = nil passwordViewController = nil

    opened by boardmain 8
  • Can't override default configuration

    Can't override default configuration

    I can't seem to override the default configurations. My code is set up just like it was before version 1.0 except for the updates needed for version 1.0.

    i.e changing backgroundImage to configuration.backgroundImage

    It seems as though it's initializing with the defaults before it hits my own in ConfigureAppearance()

    opened by dcortright 6
  • Validator Pod Errors

    Validator Pod Errors

    I am getting errors from the Validator pod which have been since resolved in the original project. Is it possible to update the Validator pod used in this framework to the latest? Thanks.

    opened by mcg95 5
  • Error Builing App

    Error Builing App

    hi after i install LoginKit from cocoapod

    if i try the run the app i have this error in build phase

    "FBSDKLoginKit" Incopatible block pointer types 'void(^)(BOOL) to parameter tof type 'void..... line 505 FBSDKLoginManager.m

    same error line 549 and 551

    opened by boardmain 5
  • Keyboard mover doesn't work

    Keyboard mover doesn't work

    @danlozano Hello, thanks for making this repository its great. Theres just one problem. The keyboard mover doesn't move when you switch textfields. Like lets say you go and create an account and click the fist textfield and click next and next, the view doesn't move above the keyboard and the textfield is stuck beneath the keyboard. The same is for login. You click on username and the contine button is stuck beneath the keyboard. Could you fix this in a new update so that all three views(password, signup, and login work for all screen sizes when the keyboard is up). Thanks.

    opened by jackpaster 3
  • Three classes not conforming to protocol ValidatableInterfaceElement

    Three classes not conforming to protocol ValidatableInterfaceElement

    Hi,

    I've tried using your LoginKit but apparently after adding it using cocoapods I'm getting the following errors:

    Type 'UISlider' does not conform to protocol 'ValidatableInterfaceElement' (UISlider+Validator.swift) Type 'UITextField' does not conform to protocol 'ValidatableInterfaceElement' (UITextField+Validator.swift) Type 'UITextView' does not conform to protocol 'ValidatableInterfaceElement' (UITextView+Validator.swift)

    All these appear inside Validator pod, which I think is a dependency pod for your LoginKit.

    Please advise which should I do to get rid fo the errors.

    Thank you, Bogdan H.

    opened by bogdanh 2
  • Add support to disable appearance animation and dismissal animation

    Add support to disable appearance animation and dismissal animation

    What does this PR do?

    • Add API to enable/disable appearance and dismissal animation. Pretty much the same API as Apple used.

    This will address issue #3

    opened by QuynhNguyen 2
  • How to get out of loop Coordinator calling start()

    How to get out of loop Coordinator calling start()

    I'm unclear about when I am supposed to be calling .finish(). The logInCoordinator.start() call is in the viewWillAppear of my app's rootViewController like the example shows and after successful LogIn and calling Finish it just goes right back to presenting another LogIn screen. Can someone please help, what am I missing?

    opened by ghost 1
  • more customization and support for ios11

    more customization and support for ios11

    hmmm like you can choose whether facebook login is enabled, and rules to validate the username/password?

    and there has been a change in api of CGFont public /not inherited/ init?(_ provider: CGDataProvider) returns an optional in ios11 sdk now

    opened by levinli303 1
  • LoginCoordinator can't performSegue

    LoginCoordinator can't performSegue

    Hi,

    Thanks for your repo.

    I need to performSegue(withIdentifier: when user login.

    I added this code:

    override func login(email: String, password: String) {
            // Handle login via your API
            print("Login with: email =\(email) password = \(password)")
            
            dataManager.login(email: email, password: "123456") { (response, error) in
                if let error = error {
                    print(error)
                } else if let response = response {
                    print("response \(response.count)")
                    DispatchQueue.main.async {
                        self.performSegue(withIdentifier: "toMainVC", sender: nil)
                    }
                }
            }
        }
    

    I got this error:

    Value of type 'LoginCoordinator' has no member 'performSegue'

    Could you please guide me how to solve it?

    Thanks.

    opened by Maryom 1
  • No such module 'LoginKit'

    No such module 'LoginKit'

    In my Podfile I added pod "ILLoginKit", then I installed pod as a normal installation. After that I went into Xcode and add import LoginKit but for some reason its yelling: No such module 'LoginKit'. Anyone encounter this problem or know how to fix it?

    I'm on Xcode Version 10.1 (10B61)

    opened by thunpisit 6
  • De-Init loginCoordinator not happening &

    De-Init loginCoordinator not happening &

    Hello,

    Thanks for the repo, great help, but I’ve spent over 12 hours in past 2 days trying to make it work but it won’t. . I’m using fire base function where authentication state change, when successful log in, triggers function in appdelegate to perform .finish() and change root view controllers. . But looking at view heirachy, and tracking initial controller & coordinator, the last two never get de-unit. And the initial view controller remains as controller and just its view in the system. . Also lastly when I’m trying to change rootviewcontroller from let to var, in coordinator class, since maybe that is causing retain cycle, it throws runtime error, and overall not letting me edit pod file without errors. . Appreciated if you do respond. Been blowing my brain with this for past two days.

    opened by ghost 1
  • UserName Text Field

    UserName Text Field

    Added in an optional username text field in the sign up view controller.

    What does this PR do?

    This pull request gives the user the option to add a username text field in the sign up view controller. I added this because I felt like when creating an account for a social app this could be useful. *

    opened by dcortright 0
  • Cancel Button?

    Cancel Button?

    Probably a stupid question - but is there a way to show a cancel button?

    For example, if my user clicks on my 'accounts' tab to either select login, or signup from the UI generated from the loginCoordinator.start() command. But actually changes his/her mind...is there a cancel button to dismiss said view that is generated?

    opened by hdmoncue 0
  • Undeclared Type 'LoginViewController'

    Undeclared Type 'LoginViewController'

    I am getting an error of 'undeclared type' with the LoginViewController class, this does not happen with LoginCoordinator class and the only difference I can see is that the LoginCoordinator class statement has an 'open' prefix to set the access level.

    opened by robert-cronin 0
Owner
Icalia Labs
Development and design firm helping companies accelerate their digital transformation through agile software processes, practices and products
Icalia Labs
A quick and simple way to authenticate an Instagram user in your iPhone or iPad app.

InstagramSimpleOAuth A quick and simple way to authenticate an Instagram user in your iPhone or iPad app. Adding InstagramSimpleOAuth to your project

Ryan Baumbach 90 Aug 20, 2022
A quick and simple way to authenticate a Dropbox user in your iPhone or iPad app.

DropboxSimpleOAuth A quick and simple way to authenticate a Dropbox user in your iPhone or iPad app. Adding DropboxSimpleOAuth to your project CocoaPo

Ryan Baumbach 42 Dec 29, 2021
A quick and simple way to authenticate a Box user in your iPhone or iPad app.

BoxSimpleOAuth A quick and simple way to authenticate a Box user in your iPhone or iPad app. Adding BoxSimpleOAuth to your project CocoaPods CocoaPods

Ryan Baumbach 15 Mar 10, 2021
SwiftCoreDataLoginPage - Login and registration with core data

Login and Registration Page with CoreData In this basic project, which was used

Buse Köseoğlu 2 Aug 22, 2022
SimpleAuth is designed to do the hard work of social account login on iOS

SimpleAuth is designed to do the hard work of social account login on iOS. It has a small set of public APIs backed by a set of "providers"

Caleb Davenport 1.2k Nov 17, 2022
An poc to make a login using Auth0 in Swift

Swift-Auth0-poc This app is an poc to make a login using Auth0. If you want to try it yourself here is a small tutorial on how to do it. 1. Configure

Sem de Wilde 1 Jan 21, 2022
ReCaptcha - Add Google's Invisible ReCaptcha v2 to your project

Add Google's Invisible ReCaptcha v2 to your project. This library automatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge if invisibility is not possible.

Flávio Caetano 250 Dec 5, 2022
Easy to use OAuth 2 library for iOS, written in Swift.

Heimdallr Heimdallr is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant f

trivago N.V. 628 Oct 17, 2022
A simple library to make authenticating tvOS apps easy via their iOS counterparts.

Voucher The new Apple TV is amazing but the keyboard input leaves a lot to be desired. Instead of making your users type credentials into their TV, yo

Riz 516 Nov 24, 2022
Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA.

Krypton turns your iOS device into a WebAuthn/U2F Authenticator: strong, unphishable 2FA. Krypton implements the standardized FIDO Universal 2nd Facto

krypt.co 332 Nov 5, 2022
LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.

LinkedInSignIn Example To run the example project, clone the repo, and run pod install from the Example directory first. Also you need to setup app on

Serhii Londar 34 Sep 1, 2022
OAuth2 framework for macOS and iOS, written in Swift.

OAuth2 OAuth2 frameworks for macOS, iOS and tvOS written in Swift 5.0. ⤵️ Installation ?? Usage ?? Sample macOS app (with data loader examples) ?? Tec

Pascal Pfiffner 1.1k Jan 2, 2023
Swift based OAuth library for iOS and macOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

OAuthSwift 3.1k Jan 3, 2023
Example of simple OAuth2 authentication using Alamofire 5 and RxSwift library

REST Client based on Alamofire 5 and RxSwift library. Supports OAuth2 and Basic authentication interceptor.

Tomáš Smolík 3 Dec 8, 2022
LoginKit is a quick and easy way to add a Login/Signup UX to your iOS app.

LoginKit About LoginKit is a quick and easy way to add Facebook and email Login/Signup UI to your app. If you need to quickly prototype an app, create

Icalia Labs 653 Dec 17, 2022
Currency Converter - Free and Quick Converter calculates money quick and easy way to see live foreign exchange rates.

Currency Converter - Free and Quick Converter calculates money quick and easy way to see live foreign exchange rates. This app is available in the App

Tirupati Balan 212 Dec 30, 2022
Jorge Ovalle 305 Oct 11, 2022
A simple way to implement Facebook and Google login in your iOS apps.

Simplicity Simplicity is a simple way to implement Facebook and Google login in your iOS apps. Simplicity can be easily extended to support other exte

Simplicity Mobile 681 Dec 18, 2022
An easy way to add mentions to uitextview like Facebook and Instagram

OEMentions An easy way to add mentions to uitextview like Facebook and Instagram. It also include a tableview to show the users list to choose from. T

Omar Alessa 48 Oct 23, 2022
The fastest iOS app to add a note to your email inbox

Major Key How often are you on the run, or hanging out with friends, only to suddenly think of this really important thing you need to do when you're

Felix Krause 190 Oct 9, 2022