#87: @available and Deprecation in Swift

Swift can express platform availability and deprecations directly in the source.

@available(iOS 16, macOS 13, *)
func useModernAPI() {}

@available(*, deprecated, renamed: "useModernAPI()")
func useOldAPI() {}

This gives the compiler enough information to warn callers and suggest migration paths.

It is one of the easiest ways to keep an API evolving without leaving users guessing.


I'm also on Twitter and GitHub.

Subscribe via RSS.