Identifier
public struct Identifier<Subject>
extension Identifier: ExpressibleByIntegerLiteral
extension Identifier: Equatable
extension Identifier: 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>'
-
Creates an
Identifierwith the givenvalue.Declaration
Swift
public init(_ value: Int)
-
Creates an
Identifierwith the givenvalue.Declaration
Swift
public init(integerLiteral value: Int)
View on GitHub
Install in Dash
Identifier Structure Reference