A collection of Objective-C macros that provide convenience methods for observing model objects on views.
- iOS
- Objective-C
BigViewModel is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BigViewModel"
In your .h @interface
add the BIG_VIEW_MODEL_PROPERTY()
macro for example:
@interface MYViewControllerBase : UIViewController
BIG_VIEW_MODEL_PROPERTY(MyAwesomeModelType*)
@end
And in your .m @implementation
add the BIG_VIEW_MODEL_KVO()
macro for example:
@implementation MYViewControllerBase
BIG_VIEW_MODEL_KVO(MyAwesomeModelType*)
@end
These macros implement a model object property and method signature in the class, for example:
@property (nonatomic,strong) MyAwesomeModelType* bigModel;
- (void)didUpdateBigModel:(MyAwesomeModelType*)bigModel;
Implement the - (void)didUpdateBigModel:
method in the .m file of the class, ror example:
- (void)didUpdateBigModel:(MyAwesomeModelType*)bigModel
{
// Do something dynamically profound in a programmatic fashion with bigModel!
}
The - (void)didUpdateBigModel:
method will be called whenever the self.big_model property is changed.
- Note: If you don't override the
- (void)didUpdateBigModel:
method, a compiler warning will be generated. If you don't plan to implement that method, you can use theBIG_VIEW_MODEL_PROPERTY_ONLY()
method instead of theBIG_VIEW_MODEL_PROPERTY()
method in your .h class header file.
- BigViewModel is developed by Vincil Bishop of Big Work Industries, LLC.
- Check out our other repositories here
- Visit us online at BigWorkIndustries.com
- A big thanks to Surge for their contributions to this and other open source projects.
BigViewModel is available under the MIT license. See the LICENSE file for more info.