LoginKit is a quick and easy way to add a Login/Signup UX to your iOS 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
Plug-n-Play login system for iOS written in Swift

Prounounced Cell-Lee Cely’s goal is to add a login system into your app in under 30 seconds! Overview Requirements Usage API Installation License Over

null 164 Nov 15, 2022
Customizable login screen, written in Swift 🔶

LFLoginController Customizable login screen, written in Swift Creating Login screens is boring and repetitive. What about implementing and customizing

Awesome Labs 152 Oct 30, 2022
Alby-installer-macos - The Extension and Companion Installer for Alby

Alby macOS Installer This is the Extension and Companion Installer for Alby. Cli

Alby 4 Mar 4, 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
Login-screen-UI - A simple iOS login screen written in Swift 5

This project has been updated to Swift 5 and Xcode 11.2 About This is a simple i

Kushal Shingote 2 Feb 4, 2022
Boarding - Instantly create a simple signup page for TestFlight beta testers

fastlane deliver • snapshot • frameit • pem • sigh • produce • cert • spaceship • pilot • boarding • gym • scan • match • precheck Get in contact with

fastlane 868 Dec 21, 2022
Add “Launch at Login” functionality to your macOS app in seconds

LaunchAtLogin Add “Launch at Login” functionality to your macOS app in seconds It's usually quite a convoluted and error-prone process to add this. No

Sindre Sorhus 1.3k Jan 6, 2023
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
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
Jorge Ovalle 305 Oct 11, 2022
A quick and "lean" way to swizzle methods for your Objective-C development needs.

Swizzlean A quick and "lean" way to swizzle methods for your Objective-C development needs. Adding Swizzlean to your project Cocoapods CocoaPods is th

Ryan Baumbach 104 Oct 11, 2022
Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Sparrow Code 31 Jan 3, 2023
Tutorials from sparrowcode.io website. You can add new, translate or fix typos. Also you can add your apps from App Store for free.

Страницы доступны на sparrowcode.io/en & sparrowcode.io/ru Как добавить свое приложение Добавьте элемент в json /ru/apps/apps.json. Если ваше приложен

Sparrow Code 30 Nov 25, 2022
Add to-do List - a mobile application where you can add your to-dos and follow them

This project, is a mobile application where you can add your to-dos and follow them. You can add your to-do's.

Cem 4 Apr 1, 2022
A way to easily add Cocoapod licenses and App Version to your iOS App using the Settings Bundle

EasyAbout Requirements: cocoapods version 1.4.0 or above. Why you should use Well, it is always nice to give credit to the ones who helped you ?? Bonu

João Mourato 54 Apr 6, 2022
An easy way to add a simple, shimmering effect to any view in an iOS app.

Shimmer Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator. Shimmer was origin

Meta Archive 9.4k Dec 26, 2022