Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ | |
| 6 #define IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 // Class to observe a boolean KVO compliant property. | |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Could you please explain in the comments how to us
michaeldo
2017/05/23 16:20:51
Done.
| |
| 11 @interface BooleanObserver : NSObject | |
| 12 | |
| 13 // The last value of performing |keyPath| on |object| after being notified of a | |
| 14 // KVO value change. NO if a change has not been observed. | |
| 15 @property(nonatomic, readonly) BOOL lastValue; | |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Should we implement more generic class that can ob
michaeldo
2017/05/23 16:20:51
Yes, but I will do this in a followup CL as part o
| |
| 16 | |
| 17 // The |keyPath| of |object| being observed. | |
| 18 @property(nonatomic, readonly) NSString* keyPath; | |
| 19 | |
| 20 // The current |object| being observed. | |
| 21 @property(nonatomic, readonly, weak) NSObject* object; | |
| 22 | |
| 23 // Sets the |object| and |keyPath| to observe. Performing |keyPath| on |object| | |
| 24 // must return a BOOL value and |keyPath| must be KVO compliant. | |
| 25 - (void)setObservedObject:(NSObject*)object keyPath:(NSString*)keyPath; | |
|
Eugene But (OOO till 7-30)
2017/05/19 18:39:48
Do you want to use nullability annotation and expl
michaeldo
2017/05/23 16:20:51
Added. PTAL. I think |keyPath| can be null if obje
| |
| 26 | |
| 27 @end | |
| 28 | |
| 29 #endif // IOS_WEB_VIEW_TEST_BOOLEAN_OBSERVER_H_ | |
| OLD | NEW |