iOS 16 Lock Screen Widgets - Open app with params

Hi, is it possible to do not just open the widget's app, but pass some additional params like it's working in "old" widgets via

public func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)

🤔

Accepted Reply

Hi!

You can use this modifier in your view: WidgetURL. This will make the entire widget a tap target that opens the host app with a URL of your choosing.

If you want specific tap targets (available in Medium+ widgets), you can also use https://developer.apple.com/documentation/swiftui/link. This is not applicable for Lock Screen widgets though.

Replies

Hi!

You can use this modifier in your view: WidgetURL. This will make the entire widget a tap target that opens the host app with a URL of your choosing.

If you want specific tap targets (available in Medium+ widgets), you can also use https://developer.apple.com/documentation/swiftui/link. This is not applicable for Lock Screen widgets though.

thanks 🙏 it's working like expected 👍

And yes, Link doesn't work at Lock Screen widgets - I already aware of it as it was the implementation we use in our app.