What's the difference between `#available(iOS)` and `#available(iOSApplicationExtension)`?

Xcode's fix-its like to insert code like this:

if #available(iOSApplicationExtension 15.0, *) {
  // Use some iOS 15 API here.
}

Usually, I just change those to this:

if #available(iOS 15.0, *) {
  // Use some iOS 15 API here.
}

It's not clear to me, though, what the difference between the two is. Is iOSApplicationExtension more or less restrictive than iOS? Are there APIs that you could only call within the first block above?

There are some APIs that are marked unavailable in extensions, but they don't seem to be affected by this attribute. This, for example, compiles just fine:

if #available(iOSApplicationExtension 15.0, *) {
  // This is marked NS_EXTENSION_UNAVAILABLE_IOS
  print(UIApplication.shared) 
}

So what's the difference?

Short answer: App Extensions are an iOS feature that allows developers to extend the functionality and content of their app beyond the app itself, making it available to users in other apps or in the main operating system. And iOS is a standalone app.

For the long answer, you can follow this link https://kingnight.github.io/programming/2021/06/09/Using-Swift-API-availability-to-solve-App-Extension-Compiled-Error.html to read more about it.

What's the difference between `#available(iOS)` and `#available(iOSApplicationExtension)`?
 
 
Q