A super simple wrapper aroundNotificationCenter.
pod'SwiftNotes'
Or just dropSwiftNotes.swiftinto your project.
when(.UIKeyboardDidShow){notein
// do stuff
}
when(.UIApplicationDidBecomeActive){_in
// do stuff
}
// define the custom event name
extensionNSNotification.Name{
staticletsomethingHappened=Notification.Name("somethingHappened")
}
// send your custom event
trigger(.somethingHappened)
when(.somethingHappened){_in
// do stuff
}
trigger(.somethingHappened,userInfo:["goodTimes":true])
trigger(.updatedFromRemote,on:self)
when(model,does:.updatedFromRemote){_in
// do stuff
}
// make sure the closure is run on the main queue
when(.somethingHappened,doOn:OperationQueue.main)_ in
// do stuff
}