Skip to content
galblank edited this page May 27, 2016 · 11 revisions

Welcome to the eventbus wiki!

Eventbus abstracts objects in any mobile projects and makes them completely agnostic of each other.

It follows Post - Subscription protocol similar to RabbitmQ. The framework is written in Swift with OBJ-C elements based on the market maturity.

Schema of event bus internal communication

Reactive Observers inside the framework diagram

Example of using event bus SWIFT import mobilefwsdk

to subscribe to events of the bus in the any point in any type of object add the following lines:

NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(MainViewController.consumeMessage(_:)), name: "internal.<message routing key>", object: nil)

to send message to a bus:

let msg: Message = Message(routKey: "internal.apiresponse") msg.params = ["api":api, "data":responseObject] msg.passthruAPI = passThruAPI

every object that is subscribed to an event should implement the following method:

func consumeMessage(notif:NSNotification){ let msg:Message = notif.userInfo?["message"] as! Message switch (msg.routingKey) { case "internal.apiresponse": ..... break }