ControlWidget Can't use onOpenURL

`struct OpenMainAppIntent: AppIntent {

static let title: LocalizedStringResource = "OpenMainAppIntent"

static var openAppWhenRun: Bool = true

init() {}

@MainActor

func perform() async throws -> some IntentResult & OpensIntent {

    guard let url = URL(string: "myapp://open") else {

        throw OpenURLError.invalidURL
    }

    return .result(opensIntent: OpenURLIntent(url))
}

} ` This is an action in my custom control widget, and i want to use this deeplink open my application and get the link's info, but it won't perform onOpenURL

`@main

struct TestControlWidgetApp: App {

var body: some Scene {

    WindowGroup {

        ContentView()

            .onOpenURL { url in

                print("url: \(url)")

            }

    }

}

}`

Hi,

Try setting a widgetURL and let me know if that works.

Rico

WWDR - DTS - Software Engineer

I also have the question, did you have any update?

ControlWidget Can't use onOpenURL
 
 
Q