In Objective-C we can know if an app is being built for device or simulator using macros:

#if TARGET_IPHONE_SIMULATOR
    // Simulator
#else
    // Device
#endif

These are compile time macros and not available at runtime.

How can I achieve the same in Swift?

20 Answers
20

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *