Swift bindings for Sinch Verification iOS SDK
This project contains Swift bindings for the Sinch Verification iOS SDK. See the Sinch Verification User Guide for complete documentation on how to use the SDK.
IMPORTANT: If you are integrating the Sinch Swift Verification SDK by adding the SinchVerification.framework to Embedded Binaries
in your application target, you must also setup the strip-frameworks.sh
to run as part of an Xcode Run Script Phase
defined in your application target’s Build Phases
section. See the online User Guide for details on how to do this.
Example
import SinchVerification;
let isoCountryCode = DeviceRegion.currentCountryCode();
let phoneNumber = try PhoneNumberUtil().parse("<user input>",
defaultRegion:isoCountryCode);
let phoneNumberE164 = PhoneNumberUtil().format(phoneNumber,
format: PhoneNumberFormat.E164);
let verification = SMSVerification(applicationKey:"<APP KEY>", phoneNumber: phoneNumberE164);
verification.initiate { (result: InitiationResult, error: Error?) -> Void in
// handle outcome
}
let code = "<user input code from SMS>"
verification.verify(code, completion: { (success: Bool, error:NSError?) -> Void in
// handle outcome
})