MGEvents 1.2.1

MGEvents 1.2.1

TestsTested
LangLanguage Obj-CObjective C
License BSD-2-Clause
ReleasedLast Release Sep 2018

Maintained by Matt Greenfield, James Vanas.



MGEvents 1.2.1

  • By
  • Matt Greenfield

MGEvents

MGEvents provides any extremely lightweight API for keypath observing, UIControl event handling, and observing and triggering custom events.

CocoaPods Setup

pod 'MGEvents'

Examples

#import <MGEvents/MGEvents.h>

Keypath Observing

[box onChangeOf:@"selected" do:^{
    NSLog(@"the new selected value is: %d", box.selected);
}];

Control Event Observing

[button onControlEvent:UIControlEventTouchUpInside do:^{
    NSLog(@"i've been touched up inside. golly.");
}];

Or in Swift:

button.onControlEvent(.TouchUpInside) {
    print("you touched me!")
}

Custom Events and Triggers

[earth on:@"ChangedShape" do:^{
    NSLog(@"the earth has changed shape");
}];

Then trigger the event:

[earth trigger:@"ChangedShape"];

Further Options

See the API reference for more details.