AnyRealmCollection

@frozen
public struct AnyRealmCollection<Element> : RealmCollectionImpl where Element : RealmCollectionValue
extension AnyRealmCollection: RealmSubscribable
extension AnyRealmCollection: Encodable where Element: Encodable

A type-erased RealmCollection.

Instances of RealmCollection forward operations to an opaque underlying collection having the same Element type. This type can be used to write non-generic code which can operate on or store multiple types of Realm collections. It does not have any runtime overhead over using the original collection directly.

  • Creates an AnyRealmCollection wrapping base.

    Declaration

    Swift

    public init<C>(_ base: C) where Element == C.Element, C : RealmCollection, C : _ObjcBridgeable
  • Returns the object at the given index.

    Declaration

    Swift

    public subscript(position: Int) -> Element { get }

    Parameters

    index

    The index.

  • A human-readable description of the objects represented by the linking objects.

    Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public static func == (lhs: AnyRealmCollection<Element>, rhs: AnyRealmCollection<Element>) -> Bool