Latest 1.0.0
Homepage https://github.com/takasek/ActionClosurable
License MIT
Platforms ios 8.0
Authors

Version
License
Platform
Carthage Compatible

Usage

ActionClosurable extends UIControl, UIButton, UIGestureRecognizer and UIBarButtonItem.
It helps writing swifty code with closure, instead of target and action like below:

// UIControl
button.on(.touchDown) {
    $0.backgroundColor = UIColor.redColor()
}
button.on(.touchUpOutside) {
    $0.backgroundColor = UIColor.whiteColor()
}
// UIButton
button.onTap {
    $0.enabled = false
}

// UIGestureRecognizer
label.addGestureRecognizer(UIPanGestureRecognizer { (gr) in
    print("UIPanGestureRecognizer fire")
})

// UIBarButtonItem
let barButtonItem = UIBarButtonItem(title: "title", style: .plain) { _ in
    print("barButtonItem title")
}

// And you can easily extend any NSObject subclasses!

And you can extend any NSObject subclasses in very easy way. Refer to the source.

Installation

for Swift 3.0

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

pod "ActionClosurable"

ActionClosurable is available through Carthage. To install it, simply add the following line to your Cartfile:

github "takasek/ActionClosurable"

for Swift 2.3

take a look at the Swift-2.3 branch

Author

takasek

License

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

Latest podspec

{
    "name": "ActionClosurable",
    "version": "1.0.0",
    "summary": "Extensions which helps to convert swifty closure to objc-style target/action.",
    "homepage": "https://github.com/takasek/ActionClosurable",
    "license": "MIT",
    "authors": {
        "takasek": "[email protected]"
    },
    "source": {
        "git": "https://github.com/takasek/ActionClosurable.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/takasek",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ActionClosurable/*.swift"
}

Pin It on Pinterest

Share This