LinkingObjects
@frozen
public struct LinkingObjects<Element> : RealmCollectionImpl where Element : RLMObjectBase, Element : RealmCollectionValue
extension LinkingObjects: RealmSubscribable
extension LinkingObjects: LinkingObjectsProtocol
LinkingObjects
is an auto-updating container type. It represents zero or more objects that are linked to its owning
model object through a property relationship.
LinkingObjects
can be queried with the same predicates as List<Element>
and Results<Element>
.
LinkingObjects
always reflects the current state of the Realm on the current thread, including during write
transactions on the current thread. The one exception to this is when using for...in
enumeration, which will always
enumerate over the linking objects that were present when the enumeration is begun, even if some of them are deleted or
modified to no longer link to the target object during the enumeration.
LinkingObjects
can only be used as a property on Object
models.
-
Creates an instance of a
LinkingObjects
. This initializer should only be called when declaring a property on a Realm model.Declaration
Swift
public init(fromType _: Element.Type, property propertyName: String)
Parameters
type
The type of the object owning the property the linking objects should refer to.
propertyName
The property name of the property the linking objects should refer to.
-
A human-readable description of the objects represented by the linking objects.
Declaration
Swift
public var description: String { get }
-
Returns the object at the given
index
.Declaration
Swift
public subscript(index: Int) -> Element { get }
Parameters
index
The index.
-
Declaration
Swift
public static func == (lhs: LinkingObjects<Element>, rhs: LinkingObjects<Element>) -> Bool
-
A publisher that emits Void each time the collection changes.
Despite the name, this actually emits after the collection has changed.
Declaration
Swift
public var objectWillChange: RealmPublishers.WillChange<LinkingObjects> { get }