Latest 1.1.0
Homepage https://github.com/XCEssentials/ViewEvents
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

GitHub tag
CocoaPods
CocoaPods
license

Introduction

Helpers for managing handlers of UIControl-based events and gesture recognizers.

How to install

The recommended way is to install using CocoaPods:

pod 'XCEViewEvents', '~> 1.1'

How it works

This library provides set of helper functions via extensions for UIControl and UIView classes. These functions are just syntax sugar on top of standard UIKit API.

How to use

For example, here is how to add handler to UIButton instance button for onTouchUpInside ("tap") event (assume we have an appropriate function called buttonTapHandler on self):

button.onTouchUpInside.add(
  #selector(buttonTapHandler),
  of: self
)

Alternatively, if self conforms to HandlersOwner protocol, the aboe example can be written like this:

self.bind(
  #selector(buttonTapHandler),
  with: button.onTouchUpInside
)

Gesture recognizers

Same approach is used to bind handlers with gesture recognizers.

For example, here is how to add handler to UIImageView instance image for "tap" gesture (assume we have an appropriate function called tapGestureHandler on self):

image.onTapGesture.addRecognizer(#selector(tapGestureHandler), of: self){ gesture in
  // configure gesture here
}

Alternatively, if self conforms to HandlersOwner protocol, the aboe example can be written like this:

self.bind(#selector(tapGestureHandler), with: image.onTapGesture){ gesture in
  // configure gesture here
}

Latest podspec

{
    "name": "XCEViewEvents",
    "summary": "Helpers for managing handlers of UIControl-based events and gesture recognizers.",
    "version": "1.1.0",
    "homepage": "https://github.com/XCEssentials/ViewEvents",
    "documentation_url": "https://XCEssentials.github.io/ViewEvents",
    "source": {
        "git": "https://github.com/XCEssentials/ViewEvents.git",
        "tag": "1.1.0"
    },
    "source_files": "Sources/**/*.swift",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "frameworks": "UIKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maxim Khatskevich": "[email protected]"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This