Classes

The following classes are available globally.

  • Get version string of the Sinch Verification SDK

    See more

    Declaration

    Swift

    open class SinchVerification
  • TextFieldPhoneNumberFormatter is a helper to perform As-You-Type-Formatting on a UITextField. The formatter performs formatting based on the region country code given at initialization.

    Example usage:

    let textField = TextField.init(...);
    let isoCountryCode = DeviceRegion.currentCountryCode();
    
    let formatter = TextFieldPhoneNumberFormatter(countryCode: isoCountryCode);
    formatter.textField = textField;
    textField.placeholder = formatter.exampleNumber(format:PhoneNumberFormat.National);
    
    formatter.onTextFieldTextDidChange = { (textField: UITextField) -> Void in
        let text = textField.text != nil ? textField.text! : "";
        let util = SharedPhoneNumberUtil();
        let isPossible = util.isPossibleNumber(textField.text, 
                                               fromRegion: isoCountryCode);
    
        // Update GUI to hint whether current 
        // user input is a viable phone number.
    }
    
    See more

    Declaration

    Swift

    public final class TextFieldPhoneNumberFormatter