Skip to content

volkanbicer/SwiftyEvents

Repository files navigation

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', :git => 'https://github.com/volkanbicer/SwiftyEvents.git'

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, vlknbcr@gmail.com

License

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published