Preview
About
Abring makes it easy to implement login to your app.
Requirements
- iOS 10.0+
- XCode 9.0
- Swift 4
Integration
CocoaPods
You can use CocoaPods to install Abring
by adding it to your Podfile:
platform :ios, '10.0'
use_frameworks!
target 'MyApp' do
pod 'Abring'
end
Usage
Go to Abring.ir website and add an app in your panel. You must set project name in ABAppConfig later in your project.
Type these to the Appdelegate.swift
file:
import Abring
ABAppConfig.name = "your App Id"
The login viewcontroller is highly customizable:
ABAppConfig.font = UIFont.systemFont(ofSize: 14) //or your own font
ABAppConfig.tintColor = UIColor.cyan
ABAppConfig.labelsColor = UIColor.gray
ABAppConfig.mainButton = UIButton() // your custom UIButton
ABAppConfig.texts.inputPhoneText = "input phone title"
ABAppConfig.texts.inputCodeText = "input code title"
ABAppConfig.buttonsTitles.loginSendCodeToPhoneButtonTitle = "Send Code"
ABAppConfig.buttonsTitles.loginConfirmCodeButtonTitle = "Done"
// you can customize textfields and their placeholders too.
and finally add this line of code in your viewcontroller to present login
presentLogin(style: .lightBlurBackground, delegate: self)
Don't forget to implement AbLoginDelegate
methods:
func userDismissScreen()
func userDidLogin(_ player: ABPlayer)
Still want more flexability?
You can ignore our UI and implement your own UI. Just use these methods when you need them:
ABPlayer.requestRegisterCode(phoneNumber: String, completion: LoginCompletionBlock) {}
ABPlayer.verifyRegisterCode(phoneNumber: String, code: String, completion: @escaping (_ success: Bool, _ player: ABPlayer?, _ errorType: ABErrorType?)
License
Abring
is available under the MIT license. See the LICENSE file for more info.