YapDatabaseViewTransaction

@interface YapDatabaseViewTransaction : YapDatabaseExtensionTransaction

#pragma mark Groups

/**
 * Returns the number of groups the view manages.
 * Each group has one or more keys in it.
 */
- (NSUInteger)numberOfGroups;

/**
 * Returns the names of all groups in an unsorted array.
 * Each group has one or more keys in it.
 *
 * @see YapDatabaseView - groupingBlock
 */
- (NSArray<NSString *> *)allGroups;

/**
 * Returns YES if there are any keys in the given group.
 * This is equivalent to ([viewTransaction numberOfItemsInGroup:group] > 0)
 */
- (BOOL)hasGroup:(NSString *)group;

#pragma mark Counts

/**
 * Returns the total number of keys in the given group.
 * If the group doesn't exist, returns zero.
 */
- (NSUInteger)numberOfItemsInGroup:(NSString *)group;

/**
 * Returns the total number of keys in every single group.
 */
- (NSUInteger)numberOfItemsInAllGroups;

/**
 * Returns YES if the group is empty (has zero items).
 * Shorthand for: [[transaction ext:viewName] numberOfItemsInGroup:group] == 0
 */
- (BOOL)isEmptyGroup:(NSString *)group;

/**
 * Returns YES if the view is empty (has zero groups).
 * Shorthand for: [[transaction ext:viewName] numberOfItemsInAllGroups] == 0
 */
- (BOOL)isEmpty;

#pragma mark Fetching

/**
 * Returns the key & collection at the given index within the given group.
 * Returns nil if the group doesn't exist, or if the index is out of bounds.
 */
- (BOOL)getKey:(NSString * _Nullable * _Nullable)keyPtr
    collection:(NSString * _Nullable * _Nullable)collectionPtr
       atIndex:(NSUInteger)index
       inGroup:(NSString *)group
NS_REFINED_FOR_SWIFT;

/**
 * Shortcut for: [view getKey:&key collection:&collection atIndex:0 inGroup:group]
 */
- (BOOL)getFirstKey:(NSString * _Nullable * _Nullable)keyPtr
         collection:(NSString * _Nullable * _Nullable)collectionPtr
            inGroup:(NSString *)group;

/**
 * Shortcut for: [view getKey:&key collection:&collection atIndex:(numberOfItemsInGroup-1) inGroup:group]
 */
- (BOOL)getLastKey:(NSString * _Nullable * _Nullable)keyPtr
        collection:(NSString * _Nullable * _Nullable)collectionPtr
           inGroup:(NSString *)group;

/**
 * Shortcut for fetching just the collection at the given index.
 */
- (nullable NSString *)collectionAtIndex:(NSUInteger)index inGroup:(NSString *)group;

/**
 * Shortcut for fetching just the key at the given index.
 * Convenient if you already know what collection the key is in.
 */
- (nullable NSString *)keyAtIndex:(NSUInteger)index inGroup:(NSString *)group;

/**
 * If the given {collection, key} are included in the view, then returns the associated group.
 * If the {collection, key} isn't in the view, then returns nil.
 */
- (nullable NSString *)groupForKey:(NSString *)key inCollection:(nullable NSString *)collection;

/**
 * Fetches both the group and the index within the group for the given {collection, key}.
 *
 * Returns YES if the {collection, key} is included in the view.
 * Otherwise returns NO, and sets the parameters to nil & zero.
 */
- (BOOL)getGroup:(NSString * _Nullable * _Nullable)groupPtr
           index:(nullable NSUInteger *)indexPtr
          forKey:(NSString *)key
    inCollection:(nullable NSString *)collection
NS_REFINED_FOR_SWIFT;

/**
 * Returns the versionTag in effect for this transaction.
 * 
 * Because this transaction may be one or more commits behind the most recent commit,
 * this method is the best way to determine the versionTag associated with what the transaction actually sees.
 * 
 * Put another way:
 * - [YapDatabaseView versionTag]            = versionTag of most recent commit
 * - [YapDatabaseViewTransaction versionTag] = versionTag of this commit
 */
- (nullable NSString *)versionTag;

#pragma mark Enumerating

/**
 * Enumerates the groups in the view.
 */
- (void)enumerateGroupsUsingBlock:(void (NS_NOESCAPE^)(NSString *group, BOOL *stop))block;

/**
 * Enumerates the keys in the given group.
 */
- (void)enumerateKeysInGroup:(NSString *)group
                  usingBlock:(void (NS_NOESCAPE^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block
NS_REFINED_FOR_SWIFT;

/**
 * Enumerates the keys in the given group.
 * Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)
 */
- (void)enumerateKeysInGroup:(NSString *)group
                 withOptions:(NSEnumerationOptions)options
                  usingBlock:(void (NS_NOESCAPE^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block
NS_REFINED_FOR_SWIFT;

/**
 * Enumerates the keys in the range of the given group.
 * Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)
 */
- (void)enumerateKeysInGroup:(NSString *)group
                 withOptions:(NSEnumerationOptions)options
                       range:(NSRange)range
                  usingBlock:(void (NS_NOESCAPE^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block
NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • Returns the number of groups the view manages. Each group has one or more keys in it.

    Declaration

    Objective-C

    - (NSUInteger)numberOfGroups;

    Swift

    func numberOfGroups() -> UInt
  • Returns the names of all groups in an unsorted array. Each group has one or more keys in it.

    See

    YapDatabaseView - groupingBlock

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)allGroups;

    Swift

    func allGroups() -> [String]
  • Returns YES if there are any keys in the given group. This is equivalent to ([viewTransaction numberOfItemsInGroup:group] > 0)

    Declaration

    Objective-C

    - (BOOL)hasGroup:(nonnull NSString *)group;

    Swift

    func hasGroup(_ group: String) -> Bool
  • Returns the total number of keys in the given group. If the group doesn’t exist, returns zero.

    Declaration

    Objective-C

    - (NSUInteger)numberOfItemsInGroup:(nonnull NSString *)group;

    Swift

    func numberOfItems(inGroup group: String) -> UInt
  • Returns the total number of keys in every single group.

    Declaration

    Objective-C

    - (NSUInteger)numberOfItemsInAllGroups;

    Swift

    func numberOfItemsInAllGroups() -> UInt
  • Returns YES if the group is empty (has zero items). Shorthand for: [[transaction ext:viewName] numberOfItemsInGroup:group] == 0

    Declaration

    Objective-C

    - (BOOL)isEmptyGroup:(nonnull NSString *)group;

    Swift

    func isEmptyGroup(_ group: String) -> Bool
  • Returns YES if the view is empty (has zero groups). Shorthand for: [[transaction ext:viewName] numberOfItemsInAllGroups] == 0

    Declaration

    Objective-C

    - (BOOL)isEmpty;

    Swift

    func isEmpty() -> Bool
  • Returns the key & collection at the given index within the given group. Returns nil if the group doesn’t exist, or if the index is out of bounds.

    Declaration

    Objective-C

    - (BOOL)getKey:(NSString *_Nullable *_Nullable)keyPtr
        collection:(NSString *_Nullable *_Nullable)collectionPtr
           atIndex:(NSUInteger)index
           inGroup:(nonnull NSString *)group;

    Swift

    func __getKey(_ keyPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, collection collectionPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, at index: UInt, inGroup group: String) -> Bool
  • Shortcut for: [view getKey:&key collection:&collection atIndex:0 inGroup:group]

    Declaration

    Objective-C

    - (BOOL)getFirstKey:(NSString *_Nullable *_Nullable)keyPtr
             collection:(NSString *_Nullable *_Nullable)collectionPtr
                inGroup:(nonnull NSString *)group;

    Swift

    func getFirstKey(_ keyPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, collection collectionPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, inGroup group: String) -> Bool
  • Shortcut for: [view getKey:&key collection:&collection atIndex:(numberOfItemsInGroup-1) inGroup:group]

    Declaration

    Objective-C

    - (BOOL)getLastKey:(NSString *_Nullable *_Nullable)keyPtr
            collection:(NSString *_Nullable *_Nullable)collectionPtr
               inGroup:(nonnull NSString *)group;

    Swift

    func getLastKey(_ keyPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, collection collectionPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, inGroup group: String) -> Bool
  • Shortcut for fetching just the collection at the given index.

    Declaration

    Objective-C

    - (nullable NSString *)collectionAtIndex:(NSUInteger)index
                                     inGroup:(nonnull NSString *)group;

    Swift

    func collection(at index: UInt, inGroup group: String) -> String?
  • Shortcut for fetching just the key at the given index. Convenient if you already know what collection the key is in.

    Declaration

    Objective-C

    - (nullable NSString *)keyAtIndex:(NSUInteger)index
                              inGroup:(nonnull NSString *)group;

    Swift

    func key(at index: UInt, inGroup group: String) -> String?
  • If the given {collection, key} are included in the view, then returns the associated group. If the {collection, key} isn’t in the view, then returns nil.

    Declaration

    Objective-C

    - (nullable NSString *)groupForKey:(nonnull NSString *)key
                          inCollection:(nullable NSString *)collection;

    Swift

    func group(forKey key: String, inCollection collection: String?) -> String?
  • Fetches both the group and the index within the group for the given {collection, key}.

    Returns YES if the {collection, key} is included in the view. Otherwise returns NO, and sets the parameters to nil & zero.

    Declaration

    Objective-C

    - (BOOL)getGroup:(NSString *_Nullable *_Nullable)groupPtr
               index:(nullable NSUInteger *)indexPtr
              forKey:(nonnull NSString *)key
        inCollection:(nullable NSString *)collection;

    Swift

    func __getGroup(_ groupPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, index indexPtr: UnsafeMutablePointer<UInt>?, forKey key: String, inCollection collection: String?) -> Bool
  • Returns the versionTag in effect for this transaction.

    Because this transaction may be one or more commits behind the most recent commit, this method is the best way to determine the versionTag associated with what the transaction actually sees.

    Put another way:

    • [YapDatabaseView versionTag] = versionTag of most recent commit
    • [YapDatabaseViewTransaction versionTag] = versionTag of this commit

    Declaration

    Objective-C

    - (nullable NSString *)versionTag;

    Swift

    func versionTag() -> String?
  • Enumerates the groups in the view.

    Declaration

    Objective-C

    - (void)enumerateGroupsUsingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                        BOOL *_Nonnull))block;

    Swift

    func enumerateGroups(_ block: (String, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Enumerates the keys in the given group.

    Declaration

    Objective-C

    - (void)enumerateKeysInGroup:(nonnull NSString *)group
                      usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                   NSString *_Nonnull, NSUInteger,
                                                   BOOL *_Nonnull))block;

    Swift

    func __enumerateKeys(inGroup group: String, using block: (String, String, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Enumerates the keys in the given group. Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)

    Declaration

    Objective-C

    - (void)enumerateKeysInGroup:(nonnull NSString *)group
                     withOptions:(NSEnumerationOptions)options
                      usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                   NSString *_Nonnull, NSUInteger,
                                                   BOOL *_Nonnull))block;

    Swift

    func __enumerateKeys(inGroup group: String, with options: NSEnumerationOptions = [], using block: (String, String, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Enumerates the keys in the range of the given group. Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)

    Declaration

    Objective-C

    - (void)enumerateKeysInGroup:(nonnull NSString *)group
                     withOptions:(NSEnumerationOptions)options
                           range:(NSRange)range
                      usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                   NSString *_Nonnull, NSUInteger,
                                                   BOOL *_Nonnull))block;

    Swift

    func __enumerateKeys(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, using block: (String, String, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Touching an object allows you to mark an item in the view as updated, even if the object itself wasn’t directly updated.

    This is most often useful when a view is being used by a tableView, but the tableView cells are also dependent upon another object in the database.

    For example:

    You have a view which includes the departments in the company, sorted by name. But as part of the cell that’s displayed for the department, you also display the number of employees in the department. The employee count comes from elsewhere. That is, the employee count isn’t a property of the department object itself. Perhaps you get the count from another view, or perhaps the count is simply the number of keys in a particular collection. Either way, when you add or remove an employee, you want to ensure that the view marks the affected department as updated so that the corresponding cell will properly redraw itself.

    So the idea is to mark certain items as updated (in terms of this view) so that the changeset for the view will properly reflect a change to the corresponding index. But you don’t actually need to update the item on disk. This is exactly what touch does.

    Touching an item has very minimal overhead. It doesn’t cause the groupingBlock or sortingBlock to be invoked, and it doesn’t cause any writes to the database.

    You can touch

    • just the object
    • just the metadata
    • or both object and metadata (the row)

    If you mark just the object as changed, and neither the groupingBlock nor sortingBlock depend upon the object, then the view doesn’t reflect any change.

    If you mark just the metadata as changed, and neither the groupingBlock nor sortingBlock depend upon the metadata, then the view doesn’t relect any change.

    In all other cases, the view will properly reflect a corresponding change in the notification that’s posted.

    Declaration

    Objective-C

    - (void)touchRowForKey:(nonnull NSString *)key
              inCollection:(nullable NSString *)collection;

    Swift

    func touchRow(forKey key: String, inCollection collection: String?)
  • Undocumented

    Declaration

    Objective-C

    - (void)touchObjectForKey:(NSString *)key inCollection:(nullable NSString *)collection;

    Swift

    func touchObject(forKey key: String, inCollection collection: String?)
  • Undocumented

    Declaration

    Objective-C

    - (void)touchMetadataForKey:(NSString *)key inCollection:(nullable NSString *)collection;

    Swift

    func touchMetadata(forKey key: String, inCollection collection: String?)
  • Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection atIndex:index inGroup:group]) { metadata = [transaction metadataForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)metadataAtIndex:(NSUInteger)index
                           inGroup:(nonnull NSString *)group;

    Swift

    func metadata(at index: UInt, inGroup group: String) -> Any?
  • Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection atIndex:index inGroup:group]) { object = [transaction objectForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)objectAtIndex:(NSUInteger)keyIndex
                         inGroup:(nonnull NSString *)group;

    Swift

    func object(at keyIndex: UInt, inGroup group: String) -> Any?
  • Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getFirstKey:&key collection:&collection inGroup:group]) { object = [transaction objectForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)firstObjectInGroup:(nonnull NSString *)group;

    Swift

    func firstObject(inGroup group: String) -> Any?
  • Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getLastKey:&key collection:&collection inGroup:group]) { object = [transaction objectForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)lastObjectInGroup:(nonnull NSString *)group;

    Swift

    func lastObject(inGroup group: String) -> Any?
  • The following methods are similar to invoking the enumerateKeysInGroup:… methods, and then fetching the metadata within your own block.

    Declaration

    Objective-C

    - (void)enumerateKeysAndMetadataInGroup:(nonnull NSString *)group
                                 usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                              NSString *_Nonnull,
                                                              id _Nullable,
                                                              NSUInteger,
                                                              BOOL *_Nonnull))block;

    Swift

    func __enumerateKeysAndMetadata(inGroup group: String, using block: (String, String, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndMetadataInGroup:(NSString *)group
                                withOptions:(NSEnumerationOptions)options
                                 usingBlock:
                        (void (NS_NOESCAPE^)(NSString *collection, NSString *key, __nullable id metadata, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateKeysAndMetadata(inGroup group: String, with options: NSEnumerationOptions = [], using block: (String, String, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndMetadataInGroup:(NSString *)group
                                withOptions:(NSEnumerationOptions)options
                                      range:(NSRange)range
                                 usingBlock:
                        (void (NS_NOESCAPE^)(NSString *collection, NSString *key, __nullable id metadata, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateKeysAndMetadata(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, using block: (String, String, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndMetadataInGroup:(NSString *)group
                                withOptions:(NSEnumerationOptions)options
                                      range:(NSRange)range
                                     filter:
                        (BOOL (NS_NOESCAPE^)(NSString *collection, NSString *key))filter
                                 usingBlock:
                        (void (NS_NOESCAPE^)(NSString *collection, NSString *key, __nullable id metadata, NSUInteger index, BOOL *stop))block;

    Swift

    func enumerateKeysAndMetadata(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, filter: (String, String) -> Bool, using block: (String, String, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • The following methods are similar to invoking the enumerateKeysInGroup:… methods, and then fetching the object within your own block.

    Declaration

    Objective-C

    - (void)enumerateKeysAndObjectsInGroup:(nonnull NSString *)group
                                usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                             NSString *_Nonnull,
                                                             id _Nonnull,
                                                             NSUInteger,
                                                             BOOL *_Nonnull))block;

    Swift

    func __enumerateKeysAndObjects(inGroup group: String, using block: (String, String, Any, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndObjectsInGroup:(NSString *)group
                               withOptions:(NSEnumerationOptions)options
                                usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateKeysAndObjects(inGroup group: String, with options: NSEnumerationOptions = [], using block: (String, String, Any, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndObjectsInGroup:(NSString *)group
                               withOptions:(NSEnumerationOptions)options
                                     range:(NSRange)range
                                usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateKeysAndObjects(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, using block: (String, String, Any, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateKeysAndObjectsInGroup:(NSString *)group
                               withOptions:(NSEnumerationOptions)options
                                     range:(NSRange)range
                                    filter:
                (BOOL (NS_NOESCAPE^)(NSString *collection, NSString *key))filter
                                usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block;

    Swift

    func enumerateKeysAndObjects(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, filter: (String, String) -> Bool, using block: (String, String, Any, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • The following methods are similar to invoking the enumerateKeysInGroup:… methods, and then fetching the object and metadata within your own block.

    Declaration

    Objective-C

    - (void)enumerateRowsInGroup:(nonnull NSString *)group
                      usingBlock:(nonnull void (^)(NSString *_Nonnull,
                                                   NSString *_Nonnull, id _Nonnull,
                                                   id _Nullable, NSUInteger,
                                                   BOOL *_Nonnull))block;

    Swift

    func __enumerateRows(inGroup group: String, using block: (String, String, Any, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateRowsInGroup:(NSString *)group
                     withOptions:(NSEnumerationOptions)options
                      usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, __nullable id metadata, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateRows(inGroup group: String, with options: NSEnumerationOptions = [], using block: (String, String, Any, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateRowsInGroup:(NSString *)group
                     withOptions:(NSEnumerationOptions)options
                           range:(NSRange)range
                      usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, __nullable id metadata, NSUInteger index, BOOL *stop))block
    NS_REFINED_FOR_SWIFT;

    Swift

    func __enumerateRows(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, using block: (String, String, Any, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateRowsInGroup:(NSString *)group
                     withOptions:(NSEnumerationOptions)options
                           range:(NSRange)range
                          filter:
                (BOOL (NS_NOESCAPE^)(NSString *collection, NSString *key))filter
                      usingBlock:
                (void (NS_NOESCAPE^)(NSString *collection, NSString *key, id object, __nullable id metadata, NSUInteger index, BOOL *stop))block;

    Swift

    func enumerateRows(inGroup group: String, with options: NSEnumerationOptions = [], range: NSRange, filter: (String, String) -> Bool, using block: (String, String, Any, Any?, UInt, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Gets the key & collection at the given indexPath, assuming the given mappings are being used. Returns NO if the indexPath is invalid, or the mappings aren’t initialized. Otherwise returns YES, and sets the key & collection ptr (both optional).

    Declaration

    Objective-C

    - (BOOL)getKey:(NSString *_Nullable *_Nullable)keyPtr
          collection:(NSString *_Nullable *_Nullable)collectionPtr
         atIndexPath:(nonnull NSIndexPath *)indexPath
        withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func __getKey(_ keyPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, collection collectionPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, at indexPath: IndexPath, with mappings: YapDatabaseViewMappings) -> Bool
  • Gets the key & collection at the given row & section, assuming the given mappings are being used. Returns NO if the row or section is invalid, or the mappings aren’t initialized. Otherwise returns YES, and sets the key & collection ptr (both optional).

    Declaration

    Objective-C

    - (BOOL)getKey:(NSString *_Nullable *_Nullable)keyPtr
          collection:(NSString *_Nullable *_Nullable)collectionPtr
              forRow:(NSUInteger)row
           inSection:(NSUInteger)section
        withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func __getKey(_ keyPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, collection collectionPtr: AutoreleasingUnsafeMutablePointer<NSString?>?, forRow row: UInt, inSection section: UInt, with mappings: YapDatabaseViewMappings) -> Bool
  • Fetches the indexPath for the given {collection, key} tuple, assuming the given mappings are being used. Returns nil if the {collection, key} tuple isn’t included in the view + mappings.

    Declaration

    Objective-C

    - (nullable NSIndexPath *)indexPathForKey:(nonnull NSString *)key
                                 inCollection:(nullable NSString *)collection
                                 withMappings:
                                     (nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func indexPath(forKey key: String, inCollection collection: String?, with mappings: YapDatabaseViewMappings) -> IndexPath?
  • Fetches the row & section for the given {collection, key} tuple, assuming the given mappings are being used. Returns NO if the {collection, key} tuple isn’t included in the view + mappings. Otherwise returns YES, and sets the row & section (both optional).

    Declaration

    Objective-C

    - (BOOL)getRow:(nullable NSUInteger *)rowPtr
             section:(nullable NSUInteger *)sectionPtr
              forKey:(nonnull NSString *)key
        inCollection:(nullable NSString *)collection
        withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func getRow(_ rowPtr: UnsafeMutablePointer<UInt>?, section sectionPtr: UnsafeMutablePointer<UInt>?, forKey key: String, inCollection collection: String?, with mappings: YapDatabaseViewMappings) -> Bool
  • Gets the object at the given indexPath, assuming the given mappings are being used.

    Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection atIndexPath:indexPath withMappings:mappings]) { object = [transaction objectForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)objectAtIndexPath:(nonnull NSIndexPath *)indexPath
                        withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func object(at indexPath: IndexPath, with mappings: YapDatabaseViewMappings) -> Any?
  • Gets the object at the given indexPath, assuming the given mappings are being used.

    Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection forRow:row inSection:section withMappings:mappings]) { object = [transaction objectForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)objectAtRow:(NSUInteger)row
                     inSection:(NSUInteger)section
                  withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func object(atRow row: UInt, inSection section: UInt, with mappings: YapDatabaseViewMappings) -> Any?
  • Gets the metadata at the given indexPath, assuming the given mappings are being used.

    Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection atIndexPath:indexPath withMappings:mappings]) { metadata = [transaction metadataForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)metadataAtIndexPath:(nonnull NSIndexPath *)indexPath
                          withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func metadata(at indexPath: IndexPath, with mappings: YapDatabaseViewMappings) -> Any?
  • Gets the object at the given indexPath, assuming the given mappings are being used.

    Equivalent to invoking:

    NSString *collection, *key; if ([[transaction ext:@myView] getKey:&key collection:&collection forRow:row inSection:section withMappings:mappings]) { metadata = [transaction metadataForKey:key inCollection:collection]; }

    Declaration

    Objective-C

    - (nullable id)metadataAtRow:(NSUInteger)row
                       inSection:(NSUInteger)section
                    withMappings:(nonnull YapDatabaseViewMappings *)mappings;

    Swift

    func metadata(atRow row: UInt, inSection section: UInt, with mappings: YapDatabaseViewMappings) -> Any?