All Projects → mithyer → Selector-Closure

mithyer / Selector-Closure

Licence: MIT License
A light way to convert objc target-action style to closure

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Selector-Closure

Closures
Swifty closures for UIKit and Foundation
Stars: ✭ 1,720 (+12185.71%)
Mutual labels:  uibutton, closures, uigesturerecognizer, convenience-methods, uicontrol
ALRadioButtons
RadioButtons for iOS. Inherited from UIControl, support 2 native styles, fully customizable.
Stars: ✭ 65 (+364.29%)
Mutual labels:  uikit, uibutton, uicontrol
Lgbutton
A fully customisable subclass of the native UIControl which allows you to create beautiful buttons without writing any line of code.
Stars: ✭ 2,216 (+15728.57%)
Mutual labels:  uibutton, uicontrol
Pmsuperbutton
🔥 PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! 😎
Stars: ✭ 653 (+4564.29%)
Mutual labels:  uibutton, closure
Swiftybutton
Simple and customizable button in Swift
Stars: ✭ 471 (+3264.29%)
Mutual labels:  uikit, uibutton
Dtgradientbutton
Easy way to set gradient background to your buttons.
Stars: ✭ 76 (+442.86%)
Mutual labels:  uikit, uibutton
Kommander Ios
A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.
Stars: ✭ 167 (+1092.86%)
Mutual labels:  block, closure
RCPickerButton
Simple button for marking some items as selected.
Stars: ✭ 17 (+21.43%)
Mutual labels:  uikit, uibutton
CheckMarkView
UI view which draws programmatically a checkmark with different styles
Stars: ✭ 35 (+150%)
Mutual labels:  uikit
ChatViewController
💬 ChatViewController, ChatBar, ImagePicker like Slack Application. Message App written in Swift
Stars: ✭ 47 (+235.71%)
Mutual labels:  uikit
iphonepip
PiP (Picture in Picture) prototype for iPhone
Stars: ✭ 15 (+7.14%)
Mutual labels:  uikit
IGStoryButtonKit
IGStoryButtonKit provides an easy-to-use button with rich animation and multiple way inspired by instagram story/stories.
Stars: ✭ 31 (+121.43%)
Mutual labels:  uikit
ukFontAwesome
Font Awesome icons for UIkit 3
Stars: ✭ 29 (+107.14%)
Mutual labels:  uikit
BIPES
BIPES: Block based Integrated Platform for Embedded Systems allows text and block based programming for several types of embedded systems and Internet of Things modules using MicroPython, CircuitPython, Python or Snek. You can connect, program, debug and monitor several types of boards using network, USB or Bluetooth. No software install needed!
Stars: ✭ 72 (+414.29%)
Mutual labels:  block
Generic-Network-Layer iOS
Generic Network Layer created using Swift.
Stars: ✭ 32 (+128.57%)
Mutual labels:  uikit
WordPress-UIkit-Starter-Theme
A WordPress starter theme for developers using the frontend framework UIkit
Stars: ✭ 55 (+292.86%)
Mutual labels:  uikit
Loafjet
🚀 Loafjet is a lightweight custom framework used to add Loafs, Dash Board, Popup Card, and Loading indicator in your Swift project
Stars: ✭ 63 (+350%)
Mutual labels:  uikit
iakit
无依赖 mini 组件库,只封装了 alert, toast, loading, actionSheet 等使用频率较高的组件。适用于类似 H5 活动页的简单移动端项目,不必为了使用这些组件而引入一个大而全的 UI 库和框架。
Stars: ✭ 38 (+171.43%)
Mutual labels:  uikit
toast-swift
A Swift Toast view - iOS 14 style and newer - built with UIKit. 🍞
Stars: ✭ 85 (+507.14%)
Mutual labels:  uikit
Musical-View
An implementation of a semi-modal view like iOS Music app.
Stars: ✭ 46 (+228.57%)
Mutual labels:  uikit

Moved to https://github.com/mithyer/Ralyo/tree/master/src/Extension/Selector-Closure

Selector-Closure

Swift32 Swift4 Platform

Selector-Closure is a light way to convert objc target-action selector to closure style

Version 1.x.x

Type of Object calling "sce" will be auto recognized in closure

UIControl

use ".sce" to make closure callback

let btn = UIButton()
let field = UITextField()

// for specific event 
_ = btn.sce.add(.touchUpInside) { sender in
  // ... sender is UIButton
}

// for default event(UIButton, UISwitch, UISlider, UITextField has default events)
let invoker = field.sce.add { sender in
  // ... sender is UITextField
}

// now you can remove action with invoker returned
field.sce.remove(invoker)

// remove all for events
field.sce.removeAll(.touchUpInside) { sender in
  // ...
}

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

UIBarButtonItem

use ".SCE" to initialize

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

// ...

UIGestureRecognizer

use ".SCE" to initialize

// init a recognizer, 
let tgr = UITapGestureRecognizer.SCE.initialize { tgr in
  // tgr is UITapGestureRecognizer
}

let sgr = UISwipeGestureRecognizer.SCE.initialize { sgr in
  // sgr is UISwipeGestureRecognizer
}

UIView

use ".sce" to make closure callback

// fast make tap action
let view = UIView()
let tapGestureRecognizer = view.sce.whenTapped { tgr in
  // tgr === tapGestureRecognizer
}

Convert your own

// you have an instance named obj
let invoker = Invoker(obj) { obj in
  // ...
}
let act = invoker.action // convert done, now pass invoker to target, act to action
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].