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.