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

The Four

The Four

Scott Galloway / Portfolio / 2017-10-3 / USD 28.00

NEW YORK TIMES BESTSELLER USA TODAY BESTSELLER Amazon, Apple, Facebook, and Google are the four most influential companies on the planet. Just about everyone thinks they know how they got there.......一起来看看 《The Four》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具