EntityId

public struct EntityId<R> : IdBase, Hashable where R : Entity
extension EntityId: ExpressibleByIntegerLiteral
extension EntityId: CustomStringConvertible

Object identifier (ID) wrapper type.

This is a wrapper for an Id value to allow attributing which entity it belongs to and which box it can be used with.

  • Numerical value of the ID.

    Declaration

    Swift

    public let value: Id
  • Initializer required by IdBase (but also a convenient short-hand).

    Declaration

    Swift

    public init(_ identifier: Id)
  • The hash value.

    • Discussion: Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Initializer to use integer literals directly, as in:

    var id: EntityId = 123

    Declaration

    Swift

    public init(integerLiteral value: Id)

    Parameters

    value

    The integer value.

  • A textual representation of this instance.

    Declaration

    Swift

    public var description: String { get }