Skip to content

Commit

Permalink
Merge pull request #3186 from yageek/bugfix/warning_3183
Browse files Browse the repository at this point in the history
Remove warning on XCode8 for #3183
  • Loading branch information
NachoSoto authored Sep 15, 2016
2 parents e744315 + 2227fcc commit 9cb9fb7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions ReactiveCocoa/Objective-C/NSObject+RACPropertySubscribing.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,23 @@
/// Returns a signal which sends the current value of the key path on
/// subscription, then sends the new value every time it changes, and sends
/// completed if self or observer is deallocated.
#define _RACObserve(TARGET, KEYPATH) \
({ \
__weak id target_ = (TARGET); \
[target_ rac_valuesForKeyPath:@keypath(TARGET, KEYPATH) observer:self]; \
})

#if __clang__ && (__clang_major__ >= 8)
#define RACObserve(TARGET, KEYPATH) _RACObserve(TARGET, KEYPATH)
#else
#define RACObserve(TARGET, KEYPATH) \
({ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wreceiver-is-weak\"") \
__weak id target_ = (TARGET); \
[target_ rac_valuesForKeyPath:@keypath(TARGET, KEYPATH) observer:self]; \
_Pragma("clang diagnostic pop") \
})
({ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wreceiver-is-weak\"") \
_RACObserve(TARGET, KEYPATH) \
_Pragma("clang diagnostic pop") \
})
#endif

@class RACDisposable;
@class RACSignal;
Expand Down

0 comments on commit 9cb9fb7

Please sign in to comment.