Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Attribute

Mattt edited this page Aug 2, 2020 · 7 revisions

Attribute

A declaration attribute.

public struct Attribute:​ Hashable, Codable

Attributes provide additional information about a declaration. For example, the @discardableResult attribute indicates that a function may be called without using the result.

Inheritance

Codable, CustomStringConvertible, ExpressibleBySyntax, Hashable

Initializers

init(_:​)

Creates an instance initialized with the given syntax node.

public init(_ node:​ AttributeSyntax)

Properties

name

The attribute name.

let name:​ String

An attribute's name is everything after the at-sign (@) and before the argument clause. For example, the name of the attribute in the following declaration is "available":​

@available(macOS 10.15, iOS 13, *)

arguments

The attribute's arguments, if any.

let arguments:[Argument]

description

var description:​ String