Widget URL on complication

Hi,

Where can we detect the widget URL when a user press a complication for both ClockKit and SwiftUI?

Post not yet marked as solved Up vote post of jonas_man Down vote post of jonas_man
1.1k views

Replies

You can't achieve both ClockKit and SwiftUI with the same method.

In ClockKit, you need to read the userInfo in handleUserActivity

In SwiftUI, you need to use .onOpenURL.

The problem I'm having though is if I use .widgetURL() in the SwiftUI view, it causes the complication to flash off/on on the watch face when the watch becomes active.

  • Call widgetURL on EmptyView. This will fix the problem you're having. eg:

    EmptyView() .widgetURL(url)

Add a Comment