SwiftEvent

码农软件 · 软件分类 · 其他(Others) · 2019-07-22 12:12:25

软件介绍

SwiftEvent 是 iOS 上 Swift 简单的事件机制。

没有参数的事件示例:

var event = Event()
event.on() {
  print("regular listener")
}
event.once() {
  print("one time listener")
}
event.emit()
event.emit()

一个参数:

var counter = 0var event   = EventWith<Int>()
event.on() {
  counter += $0}
event.once() {
  counter += $0}
event.emitWith(1)

两个参数

var counter = 0var string  = ''var event   = EventDue<Int, String>()
event.on() { (value, word) in
  counter += value
  string  += word
}
event.emitWith(1, and: 'Hello ')
event.emitWith(1, and: 'World')

多个参数

var text  = ''var event = EventWith<[String]>()
event.on() { (words) in
  text += " ".join(words)
}
event.emitWith(['Hello', 'World', '!!!'])


本文地址:https://codercto.com/soft/d/10685.html

Foundation Web Standards

Foundation Web Standards

Jonathan Lane、Steve Smith / Friends of ED / 21st July 2008 / $34.99

Foundation Web Standards explores the process of constructing a web site from start to finish. There is more to the process than just knowing HTML! Designers and developers must follow a proper proces......一起来看看 《Foundation Web Standards》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

MD5 加密
MD5 加密

MD5 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具