0

WKInterfaceTextField is only available in watchOS 6.0, so I am needing to exclude the @property from watchOS versions lower than 6.0.

Is there a preprocessor macro that I can use in the .h file to exclude the @property unless it is watchOS 6.0?

Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
  • I *think* you can do ```@available( watchOS 6, * )``` just like with iOS, but if that fails, how about ```#if __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_6_0``` – skaak Feb 22 '21 at 18:13
  • `#if __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_6_0` was what I needed. Can you post that as an answer? – Nic Hubbard Feb 22 '21 at 21:29

1 Answers1

0

You can use

#if __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_6_0

in your header file to conditionally compile the property.

Then, for completeness - the often used iOS check (albeit used in code, in your .m file) e.g.

if ( @available( iOS 13, * ) )

becomes e.g.

if ( @available( watchOS 6, * ) )

for the watch. For multiplatform this becomes e.g.

if ( @available( iOS 13, watchOS 6, * ) )
skaak
  • 2,988
  • 1
  • 8
  • 16