Utility
-
A wrapper around the metatype of any type.
This wrapper allows a metatype (
See moreT.Type,String.self, etc.) to conform toEquatableandHashable. Therefore, a metatype can be used as a key in a dictionary.Declaration
Swift
public struct Metatypeextension Metatype: Equatableextension Metatype: Hashable -
A type-safe identifier.
An
Identifieris 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> = 0The
Subjectis 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: ExpressibleByIntegerLiteralextension Identifier: Equatableextension Identifier: Hashable -
Unifying interface for
See moreRangeandClosedRangetypes.Declaration
Swift
public protocol RangeProtocol -
Interface for
See moreenumvalues whose values can be inverted.Declaration
Swift
public protocol InvertibleEnum : CaseIterable, Equatable
View on GitHub
Install in Dash
Utility Reference