Issue
How do I conditionally compile code for iOS and tvOS in the same file in the Swift language?
I have tried all the Objective-C style #if
etc. for TARGET_OS_TV
as mentioned in the Apple docs, and some other answers. But I have not found a working solution for Swift code.
Solution
#if os(OSX)
// compiles for OS X
#elseif os(iOS)
// compiles for iOS
#elseif os(tvOS)
// compiles for TV OS
#elseif os(watchOS)
// compiles for Apple watch
#endif
Answered By - Lubos Answer Checked By - Mildred Charles (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.