Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Copyright (c) 2017/3/20 shinren.pan@gmail.com All rights reserved.
- //
- #import <Foundation/Foundation.h>
- NS_ASSUME_NONNULL_BEGIN
- /**
- NSObject category for kvo binding.
- */
- @interface NSObject (KVO)
- ///-----------------------------------------------------------------------------
- /// @name Category methods
- ///-----------------------------------------------------------------------------
- /**
- 移除所有監聽.
- */
- - (void)kvo_removeObserver;
- /**
- 新增 / 移除一個 keyPath 的監聽.
- 當 changed = nil 時, 會移除目前 keyPath 的監聽.
- @param keyPath 要監聽的 keyPath.
- @param changed 監聽的 keyPath 數值變動後的 callback.
- */
- - (void)kvo_observerKayPath:(NSString *)keyPath changed:(void(^__nullable)(void))changed;
- @end
- NS_ASSUME_NONNULL_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement