Ok interesting. My intent code is unique for WatchOS and iOS because I have different parameters for the widget depending on platform. This also means having unique timeline code, one timeline provider per intent.
My intent which is only targeted to my Watch app widget extension looks like this:
struct WatchTrendWidgetIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Trend Widget Configuration"
static var description = IntentDescription("Configure trend Health type Watch Widgets.")
static var isDiscoverable: Bool { return false}
init() {}
func perform() async throws -> some IntentResult {
return .result()
}
@Parameter(title: "Chart Health Type", default: TrendHealthTypeOption.restHR)
var healthType: TrendHealthTypeOption?
@Parameter(title: "Show Day's Date", default: false)
var showDaysDate: Bool
}
I still need to test this on WatchOS 26 beta 4 but on beta 3 it worked.... In the timeline I do this:
func recommendations() -> [AppIntentRecommendation<WatchTrendWidgetIntent>] { // Only used in WatchOS
if #available(watchOS 26, *) { return []}
else ........
}
So hopefully this helps.
One of the reasons I asked about if you have existing widgets was because of this problem here: https://developer.apple.com/forums/thread/788784
Was just wondering if this issue applied to you if you had existing Watch complication/widget users?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: