Skip to content

jonasbeckers/PhoneVerificationController

 
 

Repository files navigation

PhoneVerificationController

Version License Platform Swift version

Screenshots Screenshots Screenshots Screenshots

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

CocoaPods

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

$ gem install cocoapods

To integrate PhoneVerificationController into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!

pod 'FireBase/Auth'
pod 'PhoneVerificationController'

Note that you'll need to add FireBase/Auth as well (we can't depend on it as it's a static framework). Then, run the following command:

$ pod install

Usage

Follow the first 2 steps for Firebase authentication on iOS as documenteded here. PhoneVerificationController will handle the rest, as long as you invoke it using:

import FirebaseAuth
import PhoneVerificationController

let configuration = Configuration(requestCode: { phone, completion in
	PhoneAuthProvider.provider().verifyPhoneNumber(phone, completion: completion)
}, signIn: { verificationID, verificationCode, completion in
	let credential = PhoneAuthProvider.provider().credential(withVerificationID: verificationID, verificationCode: verificationCode)
	Auth.auth().signIn(with: credential) { _, error in completion(error) }
})
let vc = PhoneVerificationController(configuration: configuration)
vc.delegate = self
present(vc, animated: true)

You'll receive a callback if the verification succeeds, or is cancelled.

Authors

License

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

About

A nicer UI for FireBase phone authentication.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 93.9%
  • Ruby 6.1%