Opening a Safari URL from an interactive widget with AppIntents

My app allows users to store URLs for future reference. It also has widgets that display these saved items. I want to make these widgets interactive by opening the linked content in Safari without having to open the main app.

The issue is that UIApplication.shared.open is not available in app extensions. And this is a problem since widgets are app extensions.

Are there alternative methods to accomplish this scenario, or is it currently unsupported?

Replies

You can't open Safari directly from widget.

But you can open your app which will open Safari.

For example, Link(destination: URL(string: "your.app.id://open_url?url=https://google.com"))