Latest 0.1
Homepage https://github.com/matthewcheok/MCObservation
License MIT
Platforms ios 7.0, requires ARC
Authors

MCObservation License MIT

Badge w/ Version
Badge w/ Platform

Easy-to-use, fire-and-forget KVO and notifications.

Installation

Add the following to your CocoaPods Podfile

pod 'MCObservation', '~> 1.0'

or clone as a git submodule,

or just copy files in the MCObservation folder into your project.

Using MCObservation

Observing changes to models

Make your view objects observe your models for changes:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
      [self mc_observeKeyPath:@"object.title" withBlock: ^(NSString *keyPath, NSDictionary *change) {
      self.textLabel.text = self.object.title;
    }];
  }
  return self;
}

Keyboard Animations

You can configure velocity, springBounciness and springSpeed.

[self mc_animateAlongsideKeyboardWithShowAnimations: ^(CGRect keyboardFrame) {
    self.textField.backgroundColor = [UIColor colorWithRed:1.000 green:0.231 blue:0.188 alpha:0.5];
} andHideAnimations: ^(CGRect keyboardFrame) {
    self.textField.backgroundColor = nil;
}];

There is no need to unregister any notifications.

License

MCObservation is under the MIT license.

Latest podspec

{
    "name": "MCObservation",
    "version": "0.1",
    "platforms": {
        "ios": "7.0"
    },
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "Easy-to-use, fire-and-forget KVO and notifications.",
    "homepage": "https://github.com/matthewcheok/MCObservation",
    "authors": {
        "Matthew Cheok": "[email protected]"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/matthewcheok/MCObservation.git",
        "branch": "master",
        "tag": "0.1"
    },
    "source_files": "MCObservation/*.{h,m}",
    "public_header_files": "MCObservation/*.h"
}

Pin It on Pinterest

Share This