GenericParameter

public struct GenericParameter : Hashable, Codable
extension GenericParameter: ExpressibleBySyntax
extension GenericParameter: 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".
  • The generic parameter attributes.

    Declaration

    Swift

    public let attributes: [Attribute]
  • The generic parameter name.

    Declaration

    Swift

    public let name: String
  • The generic parameter type, if any.

    Declaration

    Swift

    public let type: String?

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: GenericParameterSyntax)

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }