SwiftyEvents 0.1.0

SwiftyEvents 0.1.0

Maintained by Volkan Bicer.



  • By
  • Volkan Bicer

SwiftyEvents

CI Status Version License Platform

This library aims to use swifty way when you need to add target your UIControl objects.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod 'SwiftyEvents'

Usage

func addButton() {
    let button = UIButton()
    button.didTap {
        print("Button did tap")
    }
}
func addTextField() {
    let textField = UITextField()
    textField.didEdit {
        print(textField.text)
    }
}
func addSegmentedControl() {
    let segmentedControl = UISegmentedControl()
    segmentedControl.valueDidChange {
        print("Value did change!")
        }
}

Or you can use it for your custom UIControl's you don't need to do anything.

func addCustomControl() {
    let control = FancyCustomControl()
    control.action(for: .touchUpInside) {
        print("Tap event did fire")
    }
}
Supported actions
  • didTap
    • UIButton
  • valueDidChange
    • UISegmentedControl
    • UISwitch
    • UISlider
    • UIStepper
    • UIRefreshControl
    • didEdit
    • UITextField

Author

Volkan Bicer, [email protected]

License

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