ModelVersionOrder

Not available in Objective-C.
Swift
public enum ModelVersionOrder

extension ModelVersionOrder: CustomStringConvertible

A rule for ordering model versions. The persistent container performs automatic multi-step migration in the direction defined by this rule, which operates on the names of the model version. Note that the model version here is the part of its filename before ‘.xcdatamodel’ – not the optional ‘Model Version Identifier’ that you can set in the model’s properties panel.


Topics

Cases

case compare

Compare the model versions directly, but interpreting numbers like a human – using the NSString.CompareOptions.numericNSString.CompareOptions.numeric algorithm, meaning that for example MyModel_v2 precedes MyModel_v10 and MyModel_A precedes MyModel_B.

Declaration
Swift
case compare

case patternMatchCompare(String)

Match each model version against a regular expression pattern. Then compare either the entire match or, if it exists, the first capture group, using the compare algorithm.

Declaration
Swift
case patternMatchCompare(String)

case regexMatchCompare(NSRegularExpression)

Match each model version against a compiled regular expression. Then compare either the entire match or, if it exists, the first capture group, using the compare algorithm.

Declaration
Swift
case regexMatchCompare(NSRegularExpression)

case list([String])

Explicitly list all the model versions in order. The first element in the array is the the earliest version and the last is the latest version. Model versions not in the list are not considered for migration.

Declaration
Swift
case list([String])

case pairList([(String, String)])

Explicitly list the entire set of migration pairs that are permitted. This can be seen as a stricter form of .list in that .list(A, B, C) will permit A->C but .pairList((A,B), (B,C)) will not allow A->C in a single migration step. The library checks for cycles in the described migrations.

Declaration
Swift
case pairList([(String, String)])

case perStore((NSPersistentStoreDescription) -> ModelVersionOrder)

Use a different order for different stores under the same container.

Declaration

Properties

var description: String

A human-readable description of the order

Declaration
Swift
public var description: String { get }