Use iOSApplicationExtension availability check to branch code for main app and app extension

I marked one of my function as @available(iOSApplicationExtension, unavailable) because it uses UIApplication. However, when I try to use #available(iOSApplicationExtension…) or #unavailable(iOSApplicationExtension…) to avoid calling the function if it is app extension I couldn't figure out how, because the compiler insists a version number in #available or ``#unavailable` but with a version number they no longer means it is (or not) app extension but app extension above or below some iOS version.

Not sure it is impossible or I didn't figure out the correct syntax.

1 Like