Skip to content

Blocks based keypath, UIControlEvents, and custom event event handlers

License

Notifications You must be signed in to change notification settings

sobri909/MGEvents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Blocks based keypath, UIControlEvents, and custom event event handlers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •