We use API availability checks all the time to provide fallbacks for users running older iOS versions, but have you wondered how the Swift compiler handles this? In this article, we’ll take a deep dive into how the #availability
condition works, how the Swift compiler is able to know if a specific symbol is available for usage, and what the code you wrote looks like after being optimized.
I have recently authored an evolution proposal to add a new #unavailable
attribute to Swift, and while I haven’t needed to do any meaningful work on Swift’s availability system to implement it, this gave me the opportunity to learn a little more about things work deep down.
Here’s a deep dive into Swift’s availability system!
#ios #programming #mobile #swift #xcode