Id

public struct Id<E> : IdBase, Hashable where E : Entity

Object identifier type.

Object identifiers are wrappers for EntityId values which are UInt64. These are used for persisted objects. Identifiers are assigned by the framework automatically when you call Box.put.

A value of 0 indicates the object hasn’t been persisted, yet.

  • Numerical value of the ID.

    Declaration

    Swift

    public let value: EntityId
  • Convenient short-hand initializer

    Declaration

    Swift

    public init(_ identifier: EntityId)
  • 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 var hashValue: Int { get }
  • Initializer to use integer literals directly, as in:

    var id: Id = 123

    Declaration

    Swift

    public init(integerLiteral value: EntityId)

    Parameters

    value

    The integer value.

  • A textual representation of this instance.

    Declaration

    Swift

    public var description: String { get }