Skip to content

Commit

Permalink
[RLMRealm] Upate method signature to -[RLMRealm transactionWithoutNot…
Browse files Browse the repository at this point in the history
…ifying:block:error:] based on feedback in PR
  • Loading branch information
liamnichols committed Sep 20, 2019
1 parent 89f4301 commit ef0865a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Realm/RLMRealm.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,14 @@ typedef void (^RLMNotificationBlock)(RLMNotification notification, RLMRealm *rea
/**
Performs actions contained within the given block inside a write transaction.
@see `[RLMRealm transactionWithBlock:withoutNotifying:error:]`
@see `[RLMRealm transactionWithoutNotifying:block:error:]`
*/
- (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block NS_SWIFT_UNAVAILABLE("");

/**
Performs actions contained within the given block inside a write transaction.
@see `[RLMRealm transactionWithBlock:withoutNotifying:error:]`
@see `[RLMRealm transactionWithoutNotifying:block:error:]`
*/
- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error;

Expand All @@ -360,17 +360,17 @@ typedef void (^RLMNotificationBlock)(RLMNotification notification, RLMRealm *rea
`RLMRealm` instance. Notifications for different threads cannot be skipped
using this method.
@param block The block containing actions to perform.
@param tokens An array of notification tokens which were returned from adding
callbacks which you do not want to be notified for the changes
made in this write transaction.
@param block The block containing actions to perform.
@param error If an error occurs, upon return contains an `NSError` object
that describes the problem. If you are not interested in
possible errors, pass in `NULL`.
@return Whether the transaction succeeded.
*/
- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block withoutNotifying:(NSArray<RLMNotificationToken *> *)tokens error:(NSError **)error;
- (BOOL)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error;

/**
Updates the Realm and outstanding objects managed by the Realm to point to the
Expand Down
4 changes: 2 additions & 2 deletions Realm/RLMRealm.mm
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,10 @@ - (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block {
}

- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)outError {
return [self transactionWithBlock:block withoutNotifying:@[] error:outError];
return [self transactionWithoutNotifying:@[] block:block error:outError];
}

- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block withoutNotifying:(NSArray<RLMNotificationToken *> *)tokens error:(NSError **)error {
- (BOOL)transactionWithoutNotifying:(NSArray<RLMNotificationToken *> *)tokens block:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error {
[self beginWriteTransaction];
block();
if (_realm->is_in_transaction()) {
Expand Down
4 changes: 2 additions & 2 deletions Realm/Tests/NotificationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ - (void)testSuppressRealmNotificationInTransactionWithBlock {
XCTFail(@"should not have been called");
}];

[realm transactionWithBlock:^{
[realm transactionWithoutNotifying:@[token] block:^{
[realm deleteAllObjects];
} withoutNotifying:@[token] error:nil];
} error:nil];

// local realm notifications are called synchronously so no need to wait for anything
[token invalidate];
Expand Down

0 comments on commit ef0865a

Please sign in to comment.