Open Source Library Providing A Swift Based Alternative To NSNotificationCenter

I’ve mentioned a few libraries for simplifying work with NSNotificationCenter, most recently FXNotifications which provides an objective-c category adding a blocks based API and reducing memory related issues.

Here’s an open source library from Alec Larson providing a Swift based alternative to NSNotificationCenter with a very clean and simple syntax.

This example from the readme shows how simple it is to create a generic emitter with EmitterKit:

let didLogin = Event<user>()

didLogin.once { user in
  println("Successfully logged in as (user.name)!")
}

didLogin.emit(user)

The advantages of EmitterKit as stated in the readme include:

No longer be forced to typecast event data in your closures.
No longer be forced to removeObserver in your classes’ deinit methods.
Backwards-compatible with NSNotificationCenter (like UIKeyboardWillShowNotification)!
Simpler syntax

You can find Emitter-Kit on Github here.

A nice easy to use swift based library for working with NSNotificationCenter.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source Library Providing A Swift Based Alternative To NSNotificationCenter

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *