SwiftEvent Swift for iOS中的简单事件机制
迅捷事件不带参数的事件示例: var event = Event () event. on () { print ( " regular listener " ) } event. once () { print ( " one time listener " ) } event. emit ()有一个论点: var counter = 0 var event = EventWith < Int> () event. on () { counter += $0 } event. once () { counter += $0 } event. emitWith ( 1 )有两个论点: var counter = 0 var string = '' var event = EventDue < Int , Str
用户评论