Structures

The following structures are available globally.

  • An associated type declaration.

    See more

    Declaration

    Swift

    public struct AssociatedType : Declaration, Hashable, Codable
    extension AssociatedType: ExpressibleBySyntax
  • A class declaration.

    See more

    Declaration

    Swift

    public struct Class : Declaration, Hashable, Codable
    extension Class: ExpressibleBySyntax
    extension Class: CustomStringConvertible
  • A conditional compilation block declaration.

    See more

    Declaration

    Swift

    public struct ConditionalCompilationBlock : Declaration, Hashable, Codable
    extension ConditionalCompilationBlock: ExpressibleBySyntax
  • A class deinitializer declaration.

    See more

    Declaration

    Swift

    public struct Deinitializer : Declaration, Hashable, Codable
    extension Deinitializer: ExpressibleBySyntax
  • An enumeration declaration.

    See more

    Declaration

    Swift

    public struct Enumeration : Declaration, Hashable, Codable
    extension Enumeration: CustomStringConvertible
    extension Enumeration: ExpressibleBySyntax
  • An extension declaration.

    See more

    Declaration

    Swift

    public struct Extension : Declaration, Hashable, Codable
    extension Extension: ExpressibleBySyntax
    extension Extension: CustomStringConvertible
  • A function declaration.

    See more

    Declaration

    Swift

    public struct Function : Declaration, Hashable, Codable
    extension Function: ExpressibleBySyntax
    extension Function: CustomStringConvertible
  • An import declaration.

    See more

    Declaration

    Swift

    public struct Import : Declaration, Hashable, Codable
    extension Import: ExpressibleBySyntax
    extension Import: CustomStringConvertible
  • An initializer declaration.

    See more

    Declaration

    Swift

    public struct Initializer : Declaration, Hashable, Codable
    extension Initializer: ExpressibleBySyntax
    extension Initializer: CustomStringConvertible
  • An operator declaration.

    See more

    Declaration

    Swift

    public struct Operator : Declaration, Hashable, Codable
    extension Operator: ExpressibleBySyntax
  • An operator precedence group declaration.

    See more

    Declaration

    Swift

    public struct PrecedenceGroup : Declaration, Hashable, Codable
    extension PrecedenceGroup: ExpressibleBySyntax
  • A protocol declaration.

    See more

    Declaration

    Swift

    public struct Protocol : Declaration, Hashable, Codable
    extension Protocol: ExpressibleBySyntax
    extension Protocol: CustomStringConvertible
  • A structure declaration.

    See more

    Declaration

    Swift

    public struct Structure : Declaration, Hashable, Codable
    extension Structure: ExpressibleBySyntax
    extension Structure: CustomStringConvertible
  • A subscript declaration.

    See more

    Declaration

    Swift

    public struct Subscript : Declaration, Hashable, Codable
    extension Subscript: ExpressibleBySyntax
    extension Subscript: CustomStringConvertible
  • A type alias declaration.

    See more

    Declaration

    Swift

    public struct Typealias : Declaration, Hashable, Codable
    extension Typealias: ExpressibleBySyntax
  • A declaration for a property or a top-level variable or constant.

    See more

    Declaration

    Swift

    public struct Variable : Declaration, Hashable, Codable
    extension Variable: ExpressibleBySyntax
    extension Variable: CustomStringConvertible
  • A declaration attribute.

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

    See more

    Declaration

    Swift

    public struct Attribute : Hashable, Codable
    extension Attribute: ExpressibleBySyntax
    extension Attribute: CustomStringConvertible
  • A generic parameter.

    A generic type or function declaration includes a generic parameter clause, consisting of one or more generic parameters enclosed by angle brackets (<>). Each generic parameter has a name, and may also specify a type constraint. For example, the following structure declaration has two generic parameters:

    struct S<T, U: Equatable>
    
    • The first generic parameter is named "T" and has no type constraint.
    • The second generic parameter is named "U" and a type constraint on "Equatable".
    See more

    Declaration

    Swift

    public struct GenericParameter : Hashable, Codable
    extension GenericParameter: ExpressibleBySyntax
    extension GenericParameter: CustomStringConvertible
  • A generic requirement.

    A generic type or function declaration may specifying one or more requirements in a generic where clause before the opening curly brace ({) its body. Each generic requirement establishes a relation between two type identifiers.

    For example, the following declaration specifies two generic requirements:

    func difference<C1: Collection, C2: Collection>(between lhs: C1, and rhs: C2) -> [C1.Element]
       where C1.Element: Equatable, C1.Element == C2.Element
    
    • The first generic requirement establishes a conformance relation between the generic types identified by "C1.Element" and "Equatable"
    • The second generic requirement establsihes a sameType relation between the generic types identified by "C1.Element" and "C2.Element"
    See more

    Declaration

    Swift

    public struct GenericRequirement : Hashable, Codable
    extension GenericRequirement: 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"
    See more

    Declaration

    Swift

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