iosswiftxcode10ios12

How to show verification code suggestion on keyboard from Message


I watched this video What's New in Cocoa Touch at WWDC 2018 and seen:

What's New in Cocoa Touch

How to show this information?


Solution

  • Review WWDC 2018 Session 204 - Automatic Strong Passwords and Security Code AutoFill.

    You will need to use a UITextField for entry and the system keyboard (no custom controls) and set the textContentType on it to .oneTimeCode (new in iOS 12).

    let securityCodeTextField = UITextField()
    securityCodeTextField.textContentType = .oneTimeCode
    

    The operating system will detect verification codes from Messages automatically (messages that contain the word "code" or "passcode") with this UITextContentType set.