CommandBus
- 授权协议: MIT
- 开发语言: Swift
- 操作系统: iOS
- 软件首页: https://github.com/Ekhoo/CommandBus
软件介绍
一个轻量级的 Command Bus 的实现,用 Swift 编写。
使用:
{
"{CommandNameA}": "{CommandHandlerNameA}",
"{CommandNameB}": "{CommandHandlerNameB}",
"{CommandNameC}": "{CommandHandlerNameC}"
}class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
/*** Register to the Command event ***/
NSNotificationCenter.defaultCenter().addObserver(self, selector: "onCommandHandled:", name:"COMMAND_DONE", object: nil)
/*** Create the CommandBus ***/
let commandBus: CommandBus = CommandBus(configurationFileName: "configuration")!
/*** Create your own CommandHandler ***/
let customCommand: CustomCommand = CustomCommand()
/*** Send your commandHandler to the CommandBus with your event name ***/
commandBus.handle(command: customCommand, commandHandledEvent: "COMMAND_DONE")
}
func onCommandHandled(notification: NSNotification) {
/*** This method is called when the CommandHandler have done ***/
print("Command Handled: \(notification.object!)")
}
}Learn Python 3 the Hard Way
Zed A. Shaw / Addison / 2017-7-7 / USD 30.74
You Will Learn Python 3! Zed Shaw has perfected the world’s best system for learning Python 3. Follow it and you will succeed—just like the millions of beginners Zed has taught to date! You bring t......一起来看看 《Learn Python 3 the Hard Way》 这本书的介绍吧!
