RelationshipContainer
public enum RelationshipContainer<O> where O : CoreStoreObject
The containing type for relationships. Use the DynamicObject.Relationship typealias instead for shorter syntax.
class Dog: CoreStoreObject {
let master = Relationship.ToOne<Person>("master")
}
class Person: CoreStoreObject {
let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master })
}
-
These constants define what happens to relationships when an object is deleted.
Declaration
Swift
public enum DeleteRule
-
The containing type for to-one relationships. Any
CoreStoreObjectsubclass can be a destination type. Inverse relationships should be declared from the destination type as well, using theinverse:argument for the relationship.class Dog: CoreStoreObject { let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master }) }See moreImportant
Relationship.ToOneproperties are required to be stored properties. Computed properties will be ignored, includinglazyandweakproperties.Declaration
Swift
public final class ToOne<D> : RelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObject
-
The containing type for to-many unordered relationships. Any
CoreStoreObjectsubclass can be a destination type. Inverse relationships should be declared from the destination type as well, using theinverse:argument for the relationship.class Dog: CoreStoreObject { let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let pets = Relationship.ToManyUnordered<Dog>("pets", inverse: { $0.master }) }See moreImportant
Relationship.ToManyUnorderedproperties are required to be stored properties. Computed properties will be ignored, includinglazyandweakproperties.Declaration
Swift
public final class ToManyUnordered<D> : ToManyRelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObjectextension RelationshipContainer.ToManyUnordered: Sequence
-
The containing type for to-many ordered relationships. Any
CoreStoreObjectsubclass can be a destination type. Inverse relationships should be declared from the destination type as well, using theinverse:argument for the relationship.class Dog: CoreStoreObject { let master = Relationship.ToOne<Person>("master") } class Person: CoreStoreObject { let pets = Relationship.ToManyOrdered<Dog>("pets", inverse: { $0.master }) }See moreImportant
Relationship.ToManyOrderedproperties are required to be stored properties. Computed properties will be ignored, includinglazyandweakproperties.Declaration
Swift
public final class ToManyOrdered<D> : ToManyRelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObjectextension RelationshipContainer.ToManyOrdered: RandomAccessCollection
View on GitHub
RelationshipContainer Enumeration Reference