You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows publish-subscribe-style communication between components without requiring the components to explicitly be aware of each other
Features
simplifies the communication between components
decouples event senders and receivers
avoids complex and error-prone dependencies and life cycle issues
makes your code simpler
is fast
is tiny
Thread-safe
Installation
Cocoapods
pod 'SwiftEventBus', :tag =>'5.1.0', :git =>'https://github.com/cesarferreira/SwiftEventBus.git'
Carthage
github "cesarferreira/SwiftEventBus" == 5.1.0
Versions
5.+ for swift 5
3.+ for swift 4.2
2.+ for swift 3
1.1.0 for swift 2.2
Usage
1 - Prepare subscribers
Subscribers implement event handling methods that will be called when an event is received.
SwiftEventBus.onMainThread(target, name:"someEventName"){ result in
// UI thread
}
// or
SwiftEventBus.onBackgroundThread(target, name:"someEventName"){ result in
// API Access
}
2 - Post events
Post an event from any part of your code. All subscribers matching the event type will receive it.