Modifier

public struct Modifier : Hashable, Codable
extension Modifier: ExpressibleBySyntax
extension Modifier: CustomStringConvertible

A declaration modifier.

A declaration may have one or more modifiers to specify access control (private / public / etc.), declare a type member (class / static), or designate its mutability (nonmutating). A declaration modifier may specify an additional detail within enclosing parentheses (()) following its name.

For example, the following property declaration has two modifiers:

public private(set) var title: String
  • The first modifier has a name equal to "public", and a nil detail
  • The second modifier has a name equal to "private" and a detail equal to "set"
  • The declaration modifier name.

    Declaration

    Swift

    public let name: String
  • The modifier detail, if any.

    Declaration

    Swift

    public let detail: String?

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: DeclModifierSyntax)

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }