Reputation: 6824
I have a class with both targets, and I want to know if I'm running it's methods on Watch or iPhone target.
Please, just Swift answers.
Upvotes: 8
Views: 1708
Reputation: 3241
Something like this
#if os(iOS)
print("iOS")
#else
print("anything else")
#endif
Or even this
if #available(watchOS 2,*){}
if #available(iOS 9, *){}
Upvotes: 15