https://github.com/geektree0101/rxascontrolevent
Texture(Async Display Kit) Control Event Reactive Wrapper
https://github.com/geektree0101/rxascontrolevent
Last synced: about 1 month ago
JSON representation
Texture(Async Display Kit) Control Event Reactive Wrapper
- Host: GitHub
- URL: https://github.com/geektree0101/rxascontrolevent
- Owner: GeekTree0101
- License: mit
- Created: 2017-10-27T18:32:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-27T19:11:04.000Z (over 8 years ago)
- Last Synced: 2025-02-07T02:46:27.049Z (over 1 year ago)
- Language: Swift
- Size: 18.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxASControlEvent
[](https://travis-ci.org/Geektree0101/RxASControlEvent)
[](http://cocoapods.org/pods/RxASControlEvent)
[](http://cocoapods.org/pods/RxASControlEvent)
[](http://cocoapods.org/pods/RxASControlEvent)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
```swift
let button = ASButtonNode()
button.rx.event(.touchUpInside).subscribe(onNext: { _ in
print("Touch up inside")
}).disposed(by: disposeBag)
button.rx.event(.touchUpOutside).subscribe(onNext: { _ in
print("Touch up outside")
}).disposed(by: disposeBag)
button.rx.event(TOUCH_EVENT_TYPE).subscribe(onNext: { BUTTON_NODE in
// TODO:
}).disposed(by: disposeBag)
let text = ASTextNode()
text.rx.event(.allEvents).subscribe(onNext: { _ in
print("Also, TextNode can do it!")
}).disposed(by: disposeBag)
```
BUTTON_NODE is ASButtonNode
TOUCH_EVENT_TYPE
```objc
typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent)
{
/** A touch-down event in the control node. */
ASControlNodeEventTouchDown = 1 << 0,
/** A repeated touch-down event in the control node; for this event the value of the UITouch tapCount method is greater than one. */
ASControlNodeEventTouchDownRepeat = 1 << 1,
/** An event where a finger is dragged inside the bounds of the control node. */
ASControlNodeEventTouchDragInside = 1 << 2,
/** An event where a finger is dragged just outside the bounds of the control. */
ASControlNodeEventTouchDragOutside = 1 << 3,
/** A touch-up event in the control node where the finger is inside the bounds of the node. */
ASControlNodeEventTouchUpInside = 1 << 4,
/** A touch-up event in the control node where the finger is outside the bounds of the node. */
ASControlNodeEventTouchUpOutside = 1 << 5,
/** A system event canceling the current touches for the control node. */
ASControlNodeEventTouchCancel = 1 << 6,
/** A system event triggered when controls like switches, slides, etc change state. */
ASControlNodeEventValueChanged = 1 << 12,
/** A system event when the Play/Pause button on the Apple TV remote is pressed. */
ASControlNodeEventPrimaryActionTriggered = 1 << 13,
/** All events, including system events. */
ASControlNodeEventAllEvents = 0xFFFFFFFF
};
```
## Requirements
## Installation
RxASControlEvent is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'RxASControlEvent'
```
## Author
Geektree0101, h2s1880@gmail.com
## License
RxASControlEvent is available under the MIT license. See the LICENSE file for more info.