SectionedResults

public struct SectionedResults<Key, SectionElement> : SectionedResultImpl where Key : _Persistable, Key : Hashable, SectionElement : RealmCollectionValue
extension SectionedResults: RealmSubscribable

SectionedResults is a type safe collection which holds individual ResultsSections as its elements. The container is lazily evaluated, meaning that if the underlying collection has changed a full recalculation of the section keys will take place. A SectionedResults instance can be observed and it also conforms to ThreadConfined.

  • Declaration

    Swift

    public typealias Element = ResultsSection<Key, SectionElement>
  • An array of all keys in the sectioned results collection.

    Declaration

    Swift

    public var allKeys: [Key] { get }
  • Returns the section at the given index.

    Declaration

    Swift

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

    Parameters

    index

    The index.

  • Returns the object at the given IndexPath.

    Declaration

    Swift

    public subscript(indexPath: IndexPath) -> SectionElement { get }

    Parameters

    indexPath

    The IndexPath.

Sectioned Results

  • A publisher that emits Void each time the sectioned results collection changes.

    Despite the name, this actually emits after the sectioned results collection has changed.

    Declaration

    Swift

    public var objectWillChange: RealmPublishers.WillChange<SectionedResults> { get }
  • A publisher that emits the sectioned results collection each time the sectioned results collection changes.

    Declaration

    Swift

    public var collectionPublisher: RealmPublishers.Value<`Self`> { get }
  • A publisher that emits the sectioned results collection each time the sectioned results collection changes on the given property keyPaths.

    Declaration

    Swift

    public func collectionPublisher(keyPaths: [String]?) -> RealmPublishers.Value<`Self`>
  • A publisher that emits a sectioned results collection changeset each time the sectioned results collection changes.

    Declaration

    Swift

    public var changesetPublisher: RealmPublishers.SectionedResultsChangeset<`Self`> { get }
  • A publisher that emits a sectioned results collection changeset each time the sectioned results collection changes on the given property keyPaths.

    Declaration

    Swift

    public func changesetPublisher(keyPaths: [String]?) -> RealmPublishers.SectionedResultsChangeset<`Self`>