Utility
-
A wrapper around the metatype of any type.
This wrapper allows a metatype (
See moreT.Type
,String.self
, etc.) to conform toEquatable
andHashable
. Therefore, a metatype can be used as a key in a dictionary.Declaration
Swift
public struct Metatype
extension Metatype: Equatable
extension Metatype: Hashable
-
A type-safe identifier.
An
Identifier
is merely a wrapper around anInt
, but with the added type-safety of the generic type parameterSubject
.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:
See moretruck == friend // Binary operator '==' cannot be applied to operands of type 'Identifier<Truck>' and // 'Identifier<Friend>'
Declaration
Swift
public struct Identifier<Subject>
extension Identifier: ExpressibleByIntegerLiteral
extension Identifier: Equatable
extension Identifier: Hashable
-
Unifying interface for
See moreRange
andClosedRange
types.Declaration
Swift
public protocol RangeProtocol
-
Interface for
See moreenum
values whose values can be inverted.Declaration
Swift
public protocol InvertibleEnum : CaseIterable, Equatable