ARTICLES

How to specify tvOS target conditional in Swift and Objective-C

In Swift use:

#if os(tvOS)
    //tvOS code here
#elseif os(iOS)
    //iOS code here
#endif

In Objective-C use:

#if TARGET_OS_TV
    //tvOS code here
#else TARGET_OS_IOS
    //iOS code here
#endif

 

 

Did you find this post helpful? Support independent development and improve your sleep by downloading White Noise and Deep Sleep Sounds free from the App Store.



Our Products

Kitemetrics
Keyword level attribution for Apple Search Ads. Optimize your bids and increase your revenue. Sign up for free at kitemetrics.com.

White Noise and Deep Sleep Sounds
Calming and relaxing sounds that will help you sleep like a baby tonight.
Download for free from the App Store.
Get it on Google Play.