Swift: Is “#available” the most irritating new Swift feature?

I hate yellow warnings. Hate them. This new #available condition is driving me crazy. When I work on a file, I assume that file may be used in many deployment contexts, not just in the current app. So why is #available only telling me about the current project?

Screen Shot 2015-06-10 at 12.10.27 PM

Screen Shot 2015-06-10 at 12.10.43 PM

Surely, I have to be missing something here. What am I not getting?

Radar 21324005

4 Comments

  • Nope. Who cares abut obsolete versions, anyways?

  • The problem is the new throws magic is stripping the error arg off the end of the call. That version is the non-deprecated version, and the compiler thinks you are calling the deprecated version (the one without the NSError **error arg). So it is a compiler warning bug.

  • If you’re setting the minimum deployment target as iOS 9, then Xcode tells you that your check doesn’t make sense 🙂

    • My code isn’t specific to a project. It’s shared across them. Some minimum deployments may be iOS 9. Others may not.