BigViewModel 1.0.0

BigViewModel 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2016

Maintained by Vincil Bishop.



  • By
  • Vincil Bishop

A collection of Objective-C macros that provide convenience methods for observing model objects on views.

Requirements

  • iOS
  • Objective-C

Installation

BigViewModel is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BigViewModel"

Usage

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 the BIG_VIEW_MODEL_PROPERTY_ONLY() method instead of the BIG_VIEW_MODEL_PROPERTY() method in your .h class header file.

Author

License

BigViewModel is available under the MIT license. See the LICENSE file for more info.