Wednesday, August 4, 2021 [Tweets] [Favorites]

Lists of Swift Attributes

Swift Language Reference:

There are two kinds of attributes in Swift—those that apply to declarations and those that apply to types. An attribute provides additional information about the declaration or type. For example, the discardableResult attribute on a function declaration indicates that, although the function returns a value, the compiler shouldn’t generate a warning if the return value is unused.

Underscored Attributes Reference (via Slava Pestov):

This document is intended to serve as a counterpart describing underscored attributes, whose semantics are subject to change and most likely need to go through the Swift evolution process before being stabilized.

There are also @inline(__always) and @inline(never), which are not documented above, but which are discussed here and here.

Previously:

Comments

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

Leave a Comment