Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 570 Bytes

ios-subscriptiondeduplicator.rst

File metadata and controls

21 lines (14 loc) · 570 Bytes

SubscriptionDeduplicator

Deduplicates subscription notifications with the same state. The state can be of any class, allowing NSNumber-wrapped values.

It's an immutable class.

Methods

- (instancetype) runBlock:(dispatch_block_t)block ifStateDidChangeTo:(id)newState

If the new state is different from the previous one, runs the block synchronously.

Parameters:

  • block
  • ifStateDidChangeTo: newState

Returns: a new instance that you should save to track the new state.