VersionLock

public struct VersionLock : ExpressibleByDictionaryLiteral, Equatable
extension VersionLock: CustomStringConvertible, CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The VersionLock contains the version hashes for entities. This is then passed to the CoreStoreSchema, which contains all entities for the store. An assertion will be raised if any Entity doesn’t match the version hash.

class Animal: CoreStoreObject {
    let species = Value.Required<String>("species", initial: "")
    let nickname = Value.Optional<String>("nickname")
    let master = Relationship.ToOne<Person>("master")
}
class Person: CoreStoreObject {
    let name = Value.Required<String>("name", initial: "")
    let pet = Relationship.ToOne<Animal>("pet", inverse: { $0.master })
}

CoreStoreDefaults.dataStack = DataStack(
    CoreStoreSchema(
        modelVersion: "V1",
        entities: [
            Entity<Animal>("Animal"),
            Entity<Person>("Person")
        ],
        versionLock: [
            "Animal": [0x2698c812ebbc3b97, 0x751e3fa3f04cf9, 0x51fd460d3babc82, 0x92b4ba735b5a3053],
            "Person": [0xae4060a59f990ef0, 0x8ac83a6e1411c130, 0xa29fea58e2e38ab6, 0x2071bb7e33d77887]
        ]
    )
)
  • The value type for the dictionary initializer, which is UInt64

    Declaration

    Swift

    public typealias HashElement = UInt64
  • The Data hash for each entity name.

    Declaration

    Swift

    public let hashesByEntityName: [EntityName : Data]
  • Initializes a VersionLock with the version hash for each entity name.

    Declaration

    Swift

    public init(_ intArrayByEntityName: [EntityName : [HashElement]])

ExpressibleByDictionaryLiteral

Equatable

  • Declaration

    Swift

    public static func == (lhs: VersionLock, rhs: VersionLock) -> Bool

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }