IdBase

public protocol IdBase : EntityPropertyTypeConvertible, Hashable

Protocol an ObjectBox ID must conform to. Currently, there are two major types that can be used as IDs:

  • EntityId<E> which is a generic, type-safe ID struct
  • Id (or Int64) which is a simpler data type usable for IDs. Most methods that require you to specify an ID accept either type of ID.

Also used to constrain extensions:

extension Property where ValueType: IdBase { … }

(Swift doesn’t have parameterized extensions, or else we could write where ValueType == EntityId<T>.)

  • Initialize this (possibly type-specific) ID with an untyped ID as e.g. returned by the core.

    Declaration

    Swift

    init(_ entityId: Id)
  • Return this (possibly type-specific) ID as an untyped ID as needed to e.g. pass to the core.

    Declaration

    Swift

    var value: Id { get }