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 })
}

DeleteRule

  • These constants define what happens to relationships when an object is deleted.

    Declaration

    Swift

    public enum DeleteRule

ToOne

  • The containing type for to-one relationships. Any CoreStoreObject subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the inverse: 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 })
    }
    

    Important

    Relationship.ToOne properties are required to be stored properties. Computed properties will be ignored, including lazy and weak properties.
    See more

    Declaration

    Swift

    public final class ToOne<D> : RelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObject

ToManyUnordered

  • The containing type for to-many unordered relationships. Any CoreStoreObject subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the inverse: 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 })
    }
    

    Important

    Relationship.ToManyUnordered properties are required to be stored properties. Computed properties will be ignored, including lazy and weak properties.
    See more

    Declaration

    Swift

    public final class ToManyUnordered<D> : ToManyRelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObject
    extension RelationshipContainer.ToManyUnordered: Sequence

ToManyOrdered

  • The containing type for to-many ordered relationships. Any CoreStoreObject subclass can be a destination type. Inverse relationships should be declared from the destination type as well, using the inverse: 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 })
    }
    

    Important

    Relationship.ToManyOrdered properties are required to be stored properties. Computed properties will be ignored, including lazy and weak properties.
    See more

    Declaration

    Swift

    public final class ToManyOrdered<D> : ToManyRelationshipKeyPathStringConvertible, RelationshipProtocol where D : CoreStoreObject
    extension RelationshipContainer.ToManyOrdered: RandomAccessCollection