virajpsimformsolutions / UIKit.Closures

A light way to make target-action to closure in Swift.UIKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UIKit.Closures

a light way to make target-action to closure in Swift.UIKit with Swift4

UIControl

// add events
control.add(.touchUpInside) { control in
  // action
}

// or like this to convert type of control
control.add(.touchUpInside) { (btn: UIButton) in
  // action
}

// remove events
control.remove(.touchUpInside) { btn in
  // action
}

// test didAdd events
let res: Bool = control.didAdd(.touchUpInside)

UIBarButtonItem

let item = UIBarButtonItem.init(title: "test", style: .plain, { item in
   // action
})

...

...

...

UIGestureRecognizer

let r = UITapGestureRecognizer{ recognizer in
  // action
}

......

code style is more like

BlocksKit

than

Closures

About

A light way to make target-action to closure in Swift.UIKit

License:MIT License


Languages

Language:Swift 100.0%