RLMSectionedResultsChange

Objective-C

@interface RLMSectionedResultsChange : NSObject

Swift

@_nonSendable(_assumed) class RLMSectionedResultsChange : NSObject

Um objeto RLMSectionedResultsChange encapsula informações sobre alterações nos resultados seccionados que são relatados pelas notificações do Realm.

RLMSectionedResultsChange é passado para os blocos de notificação registrados com -addNotificationBlock em RLMSectionedResults e relata quais seções e linhas na coleção foram alteradas desde a última vez que o bloco de notificação foi chamado.

Um exemplo completo de atualização de um UITableView denominado tv:

[tv beginUpdates];
[tv deleteRowsAtIndexPaths:changes.deletions withRowAnimation:UITableViewRowAnimationAutomatic];
[tv insertRowsAtIndexPaths:changes.insertions withRowAnimation:UITableViewRowAnimationAutomatic];
[tv reloadRowsAtIndexPaths:changes.modifications withRowAnimation:UITableViewRowAnimationAutomatic];
[tv insertSections:changes.sectionsToInsert withRowAnimation:UITableViewRowAnimationAutomatic];
[tv deleteSections:changes.sectionsToRemove withRowAnimation:UITableViewRowAnimationAutomatic];
[tv endUpdates];

Todas as arrays em um RLMSectionedResultsChange são sempre classificadas em ordem crescente.

  • Os caminhos do índice de objetos na versão anterior da collection que foram removidos desta.

    Declaração

    Objective-C

    @property (nonatomic, readonly) NSArray<NSIndexPath *> *_Nonnull deletions;

    Swift

    var deletions: [IndexPath] { get }
  • Os caminhos do índice na nova versão da collection que foram inseridos recentemente.

    Declaração

    Objective-C

    @property (nonatomic, readonly) NSArray<NSIndexPath *> *_Nonnull insertions;

    Swift

    var insertions: [IndexPath] { get }
  • Os caminhos do índice na versão antiga da collection que foram modificados.

    Declaração

    Objective-C

    @property (nonatomic, readonly) NSArray<NSIndexPath *> *_Nonnull modifications;

    Swift

    var modifications: [IndexPath] { get }
  • Os índices das seções a serem inseridas.

    Declaração

    Objective-C

    @property (nonatomic, readonly) NSIndexSet *_Nonnull sectionsToInsert;

    Swift

    var sectionsToInsert: IndexSet { get }
  • Os índices das seções a serem removidas.

    Declaração

    Objective-C

    @property (nonatomic, readonly) NSIndexSet *_Nonnull sectionsToRemove;

    Swift

    var sectionsToRemove: IndexSet { get }
  • Retorna os caminhos de índice dos índices de exclusão na seção fornecida.

    Declaração

    Objective-C

    - (nonnull NSArray<NSIndexPath *> *)deletionsInSection:(NSUInteger)section;

    Swift

    func deletions(inSection section: UInt) -> [IndexPath]
  • Retorna os caminhos do índice dos índices de inserção na seção fornecida.

    Declaração

    Objective-C

    - (nonnull NSArray<NSIndexPath *> *)insertionsInSection:(NSUInteger)section;

    Swift

    func insertions(inSection section: UInt) -> [IndexPath]
  • Retorna os caminhos de índice dos índices de modificação na seção fornecida.

    Declaração

    Objective-C

    - (nonnull NSArray<NSIndexPath *> *)modificationsInSection:(NSUInteger)section;

    Swift

    func modifications(inSection section: UInt) -> [IndexPath]