Functions
The following functions are available globally.
- 
                  
                  
Infix operator for testing if a string matches a regular expression.
Example
let sentence = "The world is flat." if sentence =~ "^The" { // The sentence starts with "The" }Declaration
Swift
public func =~ (input: String, pattern: String) -> BoolParameters
inputThe string that should be tested.
patternThe regular expression that should be used for testing.
 - 
                  
                  
Infix operator for testing if a string matches a regular expression.
Example
let pattern = RegularExpression("^The")! let sentence = "The world is flat." if sentence =~ pattern { // The sentence starts with "The" }Declaration
Swift
public func =~ (input: String, pattern: RegularExpression) -> BoolParameters
inputThe string that should be tested.
patternThe regular expression that should be used for testing.
 
- 
                  
                  
Challenges the user to authenticate as the device owner. Biometric authentication (Face ID or Touch ID) is tried first if available and passcode authentication is used as a fallback.
Examples
var context = authenticateDeviceOwner(reason: "Unlock something") { authenticationError in guard authenticationError == nil else { // Failed to authenticate (the user just might have cancelled) // TODO: Handle error return } // Successfully authenticated unlockSomething() } // Invalidate context context.invalidate()Note
In order to use Face ID, add [
NSFaceIDUsageDescription][https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75] to your [Info.plist][https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009248-SW1].Declaration
Swift
public func authenticateDeviceOwner( reason: String, completion: @escaping (_ authenticationError: AuthenticationError?) -> Void ) -> AuthenticationContextParameters
reasonThe reason describing the purpose of the authentication.
completionA function that is called after the authentication finished (not neccessarily successfully).
authenticationErrorUpon successful authentication this is
nilelse it contains the cause for failure.Return Value
The authentication context.
 
            View on GitHub
          
      Functions  Reference