This library provides these 5 major classes:
Event : A type-safe event emitter.
Signal : An event emitter that doesn't pass any data.
Listener : An event listener!
Notification
: Backwards-compatibility with NSNotification
.
Change : Key-value observation made easy.
NSNotification
& NSNotificationCenter
are rather verbose and fail to provide type-safety. This library aims to streamline your work with event emitters & listeners while programming with Swift. It aims to stay as simple as possible without removing powerful features.
This is a list of notable changes in each version of emitter-kit. Many versions include unlisted bug fixes and refactoring. Some changes may not be listed (unintentionally).
- Xcode 7.0 Beta 4 compatible
- Swift 2.0 compatible
- Swift 1.3 compatible
- Swift 1.2 compatible
- Added
isPrior: Boolean
to theChange
class.
-
Added
NotificationListener
,EmitterListener
, andChangeListener
(all subclasses ofListener
). -
Added
Change
, a generic class with anoldValue
, anewValue
, and akeyPath
. -
All
NSObject
s have anon()
andonce()
method for KVO! -
Notification
does not subclassEmitter
anymore. -
Notification
now hasemit
methods that createNSNotification
s under the hood. -
Notification
no longer need to be retained. -
Removed
emitter.removeAllListeners()
. -
Removed
emitter.listenersForTarget(target: AnyObject)
. -
Removed
ListenerStorage
completely. Try using an[Listener]
or[String:Listener]
. -
Removed many exposed internal functions.
-
Renamed
VoidEvent
toSignal
. -
Renamed
AnyEvent
toEmitter
. -
Renamed
EventListener
toListener
. -
Renamed
EventListenerStorage
toListenerStorage
. -
Renamed
emitter.clearListeners()
toemitter.removeAllListeners()
.
- Xcode 6.0 Beta 5 compatible