NSUserDefaults+RACSupport.h 864 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // NSUserDefaults+RACSupport.h
  3. // ReactiveObjC
  4. //
  5. // Created by Matt Diephouse on 12/19/13.
  6. // Copyright (c) 2013 GitHub, Inc. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class RACChannelTerminal;
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface NSUserDefaults (RACSupport)
  12. /// Creates and returns a terminal for binding the user defaults key.
  13. ///
  14. /// **Note:** The value in the user defaults is *asynchronously* updated with
  15. /// values sent to the channel.
  16. ///
  17. /// key - The user defaults key to create the channel terminal for.
  18. ///
  19. /// Returns a channel terminal that sends the value of the user defaults key
  20. /// upon subscription, sends an updated value whenever the default changes, and
  21. /// updates the default asynchronously with values it receives.
  22. - (RACChannelTerminal *)rac_channelTerminalForKey:(NSString *)key;
  23. @end
  24. NS_ASSUME_NONNULL_END