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