MGEvents provides any extremely lightweight API for keypath observing, UIControl event handling, and observing and triggering custom events.
pod 'MGEvents'
#import <MGEvents/MGEvents.h>
[box onChangeOf:@"selected" do:^{
NSLog(@"the new selected value is: %d", box.selected);
}];
[button onControlEvent:UIControlEventTouchUpInside do:^{
NSLog(@"i've been touched up inside. golly.");
}];
Or in Swift:
button.onControlEvent(.TouchUpInside) {
print("you touched me!")
}
[earth on:@"ChangedShape" do:^{
NSLog(@"the earth has changed shape");
}];
Then trigger the event:
[earth trigger:@"ChangedShape"];
See the API reference for more details.