All Projects → onmyway133 → Easyclosure

onmyway133 / Easyclosure

Licence: other
🍩 Unified communication patterns with easy closure in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Easyclosure

Golang Action
A GitHub Action to run Go commands
Stars: ✭ 119 (-40.5%)
Mutual labels:  action
Release Drafter
Drafts your next release notes as pull requests are merged into master.
Stars: ✭ 2,119 (+959.5%)
Mutual labels:  action
Gcloud
GitHub Action for interacting with Google Cloud Platform (GCP)
Stars: ✭ 153 (-23.5%)
Mutual labels:  action
Zoo
🌈 Cute pet zoo. Come and adopt a cute you like. 萌萌乐园,全自动领养自己喜欢的萌物。
Stars: ✭ 121 (-39.5%)
Mutual labels:  action
Figma Action
Export image assets from Figma to GitHub
Stars: ✭ 134 (-33%)
Mutual labels:  action
Pr Size Labeler
🏷 Visualize and optionally limit the size of your Pull Requests
Stars: ✭ 140 (-30%)
Mutual labels:  action
Essential Netty In Action
It is a book about the Essentials of Norman Maurer's Netty in Action.《Netty 实战(精髓)》是对 Norman Maurer 的 《Netty in Action》的一个精简
Stars: ✭ 1,502 (+651%)
Mutual labels:  action
Ts Action
TypeScript action creators for Redux
Stars: ✭ 173 (-13.5%)
Mutual labels:  action
Github Action Markdown Link Check
Check all links in markdown files if they are alive or dead. 🔗✔️
Stars: ✭ 132 (-34%)
Mutual labels:  action
Nbmake Action
GitHub Action for testing notebooks
Stars: ✭ 151 (-24.5%)
Mutual labels:  action
Javascript.anomaly
Examples of not obvious behaviors for javascript beginner programmers
Stars: ✭ 124 (-38%)
Mutual labels:  closure
Linker
🎯 Your easiest way to handle all URLs.
Stars: ✭ 129 (-35.5%)
Mutual labels:  closure
Upload To Release
A GitHub Action that uploads a file to a new release.
Stars: ✭ 144 (-28%)
Mutual labels:  action
Actionclosurable
Extensions which helps to convert objc-style target/action to swifty closures
Stars: ✭ 120 (-40%)
Mutual labels:  closure
Github Sync
⤵️ A GitHub Action for syncing current repository with remote
Stars: ✭ 166 (-17%)
Mutual labels:  action
3d Densenet
3D Dense Connected Convolutional Network (3D-DenseNet for action recognition)
Stars: ✭ 118 (-41%)
Mutual labels:  action
Redux Dataloader
Loads async data for Redux apps focusing on preventing duplicated requests and dealing with async dependencies.
Stars: ✭ 139 (-30.5%)
Mutual labels:  action
Cleanclosurexcode
An Xcode Source Editor extension to clean the closure syntax.
Stars: ✭ 186 (-7%)
Mutual labels:  closure
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 (-16.5%)
Mutual labels:  closure
Goaction
Write Github actions in Go
Stars: ✭ 149 (-25.5%)
Mutual labels:  action

EasyClosure

❤️ Support my apps ❤️

❤️❤️😇😍🤘❤️❤️

Version Carthage Compatible License Platform Swift

Table of contents

Story

There are many Communication patterns

Sometimes, you just want a unified and quick way to do it. Just call on on any NSObject subclasses and handle your events the quickest way

Features

  • [x] Shortcut to handle actions and events
  • [x] Easy to extend
  • [x] Correct method suggestion based on generic protocol constraint
  • [x] Support iOS, macOS

Example

We can make a fun demo of good, cheap, fast with UISwitch

func allOn() -> Bool {
  return [good, cheap, fast].filter({ $0.isOn }).count == 3
}

good.on.valueChange { _ in
  if allOn() {
    fast.setOn(false, animated: true)
  }
}

cheap.on.valueChange { _ in
  if allOn() {
    good.setOn(false, animated: true)
  }
}

fast.on.valueChange { _ in
  if allOn() {
    cheap.setOn(false, animated: true)
  }
}

Target-Action and Delegate

UIButton

button.on.tap {
  print("button has been tapped")
}

UISlider

slider.on.valueChange { value in
  print("slider has changed value")
}

UITextField

textField.on.textChange { text in
  print("textField text has changed")
}

UITextView

textView.on.textChange { text in
  print("textView text has changed")
}

UISearchBar

searchBar.on.textChange { text in
  print("searchBar text has changed")
}

UIDatePicker

datePicker.on.pick { date in
  print("datePicker has changed date")
}

UIBarButtonItem

barButtonItem.on.tap {
  print("barButtonItem has been tapped")
}

UIGestureRecognizer

gestureRecognizer.on.occur {
  print("gesture just occured")
}

Extensible

Extend Container and specify Host to add more functionalities to your own types. For example

public extension Container where Host: UITableView {
  func cellTap(_ action: @escaping (UITableViewCell) -> Void)) {
    // Your code here here
  }
}

// usage
let tableView = UITableView()
tableView.on.cellTap { cell in
  
}

Installation

EasyClosure is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EasyClosure'

EasyClosure is also available through Carthage. To install just write into your Cartfile:

github "onmyway133/EasyClosure"

EasyClosure can also be installed manually. Just download and drop Sources folders in your project.

Author

Khoa Pham, [email protected]

Contributing

We would love you to contribute to EasyClosure, check the CONTRIBUTING file for more info.

License

EasyClosure is available under the MIT license. See the LICENSE file for more info.

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].