TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jan 2018 |
SPMSupports SPM | ✓ |
Maintained by David Jennes.
Depends on: | |
CountryPickerSwift | ~> 1.4 |
PhoneNumberKit | ~> 2.0.0 |
To run the example project, clone the repo, and run pod install
from the Example directory first.
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
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.
PhoneVerificationController is available under the MIT license. See the LICENSE file for more info.