EkoCollection

@interface EkoCollection<__covariant ObjectType> : NSObject

A collection is a container type returned from queries. Clients can request to load more and observe insertions and changes to the objects in the collection. Initially the count will be zero. Observers will be notified of changes.

  • The number objects

    Declaration

    Objective-C

    - (NSUInteger)count;

    Swift

    func count() -> UInt

    Return Value

    NSUInteger

  • Returns an instance at a given index

    Declaration

    Objective-C

    - (nullable ObjectType)objectAtIndex:(NSUInteger)idx;

    Swift

    func object(at idx: UInt) -> ObjectType?

    Parameters

    idx

    An index in the collection

    Return Value

    an object

  • Reset the current records being displayed to the default last page

    Declaration

    Objective-C

    - (void)resetPage;

    Swift

    func resetPage()
  • Requests more objects to load if any are available

    Declaration

    Objective-C

    - (void)previousPage;

    Swift

    func previousPage()
  • Requests more objects to load if any are available

    Declaration

    Objective-C

    - (void)nextPage;

    Swift

    func nextPage()
  • Adds a block to observe changes in the collection

    Declaration

    Objective-C

    - (nonnull EkoNotificationToken *)observeWithBlock:
        (nonnull void (^)(EkoCollection<ObjectType> *_Nonnull,
                          EkoCollectionChange *_Nullable, NSError *_Nullable))block;

    Swift

    func observe(_ block: @escaping (EkoCollection<ObjectType>, EkoCollectionChange?, Error?) -> Void) -> EkoNotificationToken

    Parameters

    block

    called when the collection or any of the underlying objects have changed

    Return Value

    EkoNotificationToken object that should be retained to continue to observe.

  • Adds a block to observe changes in the collection exactly once

    Declaration

    Objective-C

    - (nonnull EkoNotificationToken *)observeOnceWithBlock:
        (nonnull void (^)(EkoCollection<ObjectType> *_Nonnull,
                          EkoCollectionChange *_Nullable, NSError *_Nullable))block;

    Swift

    func observeOnce(_ block: @escaping (EkoCollection<ObjectType>, EkoCollectionChange?, Error?) -> Void) -> EkoNotificationToken

    Parameters

    block

    called exactly once when the collection or any of the underlying objects have changed

    Return Value

    EkoNotificationToken object that should be retained to continue to observe.

  • Unavailable

    Block call of init and new because EkoObject cannot be created directly

    Declaration

    Objective-C

    - (nonnull instancetype)init;