Search code examples
iosobjective-ciphoneswifttoday-extension

open passcode screen from today widget


I have today widget, which will display that the phone is locked as status, when the phone is locked.

When I tapped on the widget, it should open the Passcode screen which will unlock after entering the passcode.

Is there any way to this requirement?


Solution

  • I´m not sure that you could force to show the passcode screen, but if you add a tap event on your widget and in the tap event function add code to open your application it will go to the passcode screen (if the phone is locked" and then open your app.

    Try this code in your tapped function:

    func openMainApp() {
       let url = URL(fileURLWithPath: "YourAppSchemeName://home")
       self.extensionContext?.open(url, completionHandler: nil)
    }