Utility

  • A wrapper around the metatype of any type.

    This wrapper allows a metatype (T.Type, String.self, etc.) to conform to Equatable and Hashable. Therefore, a metatype can be used as a key in a dictionary.

    See more

    Declaration

    Swift

    public struct Metatype
    extension Metatype: Equatable
    extension Metatype: Hashable
  • A type-safe identifier.

    An Identifier is merely a wrapper around an Int, but with the added type-safety of the generic type parameter Subject.

    let truck: Identifier<Truck> = 0
    let friend: Identifier<Friend> = 0
    

    The Subject is not used within the type, but it exists to ensure that things like this don’t compile:

    truck == friend
    // Binary operator '==' cannot be applied to operands of type 'Identifier<Truck>' and
    // 'Identifier<Friend>'
    
    See more

    Declaration

    Swift

    public struct Identifier<Subject>
    extension Identifier: ExpressibleByIntegerLiteral
    extension Identifier: Equatable
    extension Identifier: Hashable
  • Unifying interface for Range and ClosedRange types.

    See more

    Declaration

    Swift

    public protocol RangeProtocol
  • Interface for enum values whose values can be inverted.

    See more

    Declaration

    Swift

    public protocol InvertibleEnum : CaseIterable, Equatable