4/22/2016

Detect iOS or WatchOS

I wanted to share a class with iPhone and Watch Extension.
But some methods and properties are not supported by both targets.

I simply used preprocessor macros:

Done!😄
As well, we can use #if os(watchOS) too since Xcode 7.2!

[Xcode Version 7.3 (7D175)]
[Swift version 2.2 (swiftlang-703.0.18.1 clang-703.0.29)]
[WatchOS version 2.2]

No comments:

Post a Comment