Wednesday, September 15, 2021 [Tweets] [Favorites]

Creating Compile-Time Reminders in Xcode

Robin Kunde:

This attribute will produce a warning if the selected Swift version is available in the version of Xcode you’re using. For 5.5 for example, this would generate a warning in Xcode 13.0 but not Xcode 12.5.

[…]

This attribute will produce a warning if the selected iOS (or tvOS, or macOS) version is equal to or below your deployment target. In other words […] after you remove support for older operating systems.

[…]

By wrapping [a #warning] in this condtional compilation check, you can get Xcode to ignore the statement until you’re using an Xcode version that ships with the given compiler version.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment