WatchOS 8 support when migrating to widgetkit

https://developer.apple.com/documentation/widgetkit/converting-a-clockkit-app

In this migration guide, there is a section that mentions: "As soon as your WidgetKit extension begins providing widget-based complications, the system disables your app’s ClockKit complications".

We currently support iOS 14 and above. If I interpret this correctly, our users will lose access to watch complications until they upgrade to watchOS 9?

i.e. If we add support for WidgetKit complications, our users on the older WatchOS 8 and below will no longer have complications?

I think this means:

  • On watchOS 9 your complications will be provided by WidgetKit because they replace the ClockKit versions.
  • On watchOS 8 your complications will continue to be provided by ClockKit because WidgetKit isn't available in watchOS 8.

I am migrating a WatchKit complication that I support back to WatchOS 6.0 to WidgetKit. How do I support ClockKit in WatchOS prior to 9.0 and WidgetKit in 9.0 and newer? I can't seem to get my WidgetKit Extension to compile is I have WatchOS support earlier than 9.0. The compiler complains that things like "Timeline" doesn't exist prior to WatchOS 9.0, and I don't know how to conditional that since it is a runtime decision. (can't if #available around a class definition.) I'm sure it is something simple I am missing.

An no sooner did I type the question did I find the answer. I need to set BaseSDK and supportedPlatforms to WatchOS under BuildSettings which allowed me to set Deployment Target to 9.0 under General.

WatchOS 8 support when migrating to widgetkit
 
 
Q