1. 首页
  2. 考试认证
  3. 其它
  4. SwiftEvent Swift for iOS中的简单事件机制

SwiftEvent Swift for iOS中的简单事件机制

上传者: 2024-09-21 01:55:49上传 ZIP文件 3.22KB 热度 2次
迅捷事件不带参数的事件示例: 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
用户评论