Structure

public struct Structure : Declaration, Hashable, Codable
extension Structure: ExpressibleBySyntax
extension Structure: CustomStringConvertible

A structure declaration.

  • Undocumented

    Declaration

    Swift

    public let context: String?
  • The declaration attributes.

    Declaration

    Swift

    public let attributes: [Attribute]
  • The declaration modifiers.

    Declaration

    Swift

    public let modifiers: [Modifier]
  • The declaration keyword ("struct").

    Declaration

    Swift

    public let keyword: String
  • The structure name.

    Declaration

    Swift

    public let name: String
  • A list of adopted protocols.

    For example, given the following declarations, the inheritance of structure S is ["P", "Q"]:

    protocol P {}
    protocol Q {}
    struct S {}
    

    Declaration

    Swift

    public let inheritance: [String]
  • The generic parameters for the declaration.

    For example, the following declaration of structure S has a single generic parameter whose name is "T" and type is "Equatable":

    struct S<T: Equatable> {}
    

    Declaration

    Swift

    public let genericParameters: [GenericParameter]
  • The generic parameter requirements for the declaration.

    For example, the following declaration of structure S has a single requirement that its generic parameter identified as "T" conforms to the type identified as "Hahable":

    struct S<T> where T: Hashable {}
    

    Declaration

    Swift

    public let genericRequirements: [GenericRequirement]

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: StructDeclSyntax)

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }