Latest 0.1.0
Homepage https://github.com/volkanbicer/SwiftyEvents
License MIT
Platforms ios 8.0
Authors

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, [email protected]

License

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

Latest podspec

{
    "name": "SwiftyEvents",
    "version": "0.1.0",
    "summary": "This library aims to use swifty way when you need to add target your UIControl objects.",
    "description": "This library aims to use swifty way when you need to add target your UIControl objects. You can listen event by closures.",
    "homepage": "https://github.com/volkanbicer/SwiftyEvents",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Volkan Bicer": "[email protected]"
    },
    "source": {
        "git": "https://github.com/volkanbicer/SwiftyEvents.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SwiftyEvents/Classes/**/*"
}

Pin It on Pinterest

Share This