If you are developing a macOS catalyst app, you may be wondering how to conditionally write code specifically for iOS, iPad OS, or the macOS 10.15 catalyst app.
Here is how to do it.
Use the code below to declare specifically written code, which will compile only for iOS and iPadOS.
#if !targetEnvironment(macCatalyst)
// Code that will execute only on iOS 13, iPadOS 13 and above
#endif
Use the code below to compile only for the macOS 10.15 Catalina Catalyst app and above.
#if targetEnvironment(macCatalyst)
// Code that will execute only on Mac
#endif
Hope it helps,
Thanks & Regards
Mandar Apte