0

I have a link written in SwiftUI inside Widget View like this:

            Link("Visit Apple",
                  destination: URL(string: "https://www.apple.com")!)
                .font(.caption)
                .foregroundColor(.red)

But now, I need to open this in Safari. Is it possible without opening the host app?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

1

No, WidgetKit widgets always open their app. There’s no way around it. The best you can do is have your widget open your app (passing the web url) and then your app opens the passes URL in Safari automatically.

Adam
  • 4,405
  • 16
  • 23