1

I have an application using WatchKit and one of the function includes a switch statement for checking a CLKComplicationFamily, essentially

switch complication.family {
case .extraLarge:
  ...
case .circularSmall:
  ...
...
}

Some types of CLKComplicationFamily, such as .graphicCorner, are only available starting WatchOS 5.0. As per this answer, I decided to use an #if compiler control statement to compile some cases only if the WatchOS version is at least 5 (otherwise there were complaints from the compiler).

However, as per the Apple Documentation, there is only the option to check for WatchOS, not for its exact version.

Therefore: How do I best handle the case where some types I am matching against in a switch-case are only available starting from a specific WatchOS version?

I do want to support devices with older versions as well, so marking the whole function as @available is (at least in my opinion) not the way to go.

alistairv
  • 159
  • 9

0 Answers0