You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
Gesture recognizers currently emit themselves along the stream's next channel, meaning we need operators like whenRecognitionStateIs and translationIn in order to extract values from the object.
I'd like to make gesture streams closer in shape to spring/tween streams in that they'd have specific streams for translation and velocity that could be subscribed to. For example, an API for a gesture recognizer interaction might look like so:
classPanGesture:Interaction{func velocityStream(in:UIView)->MotionObservable<CGPoint>func translationStream(in:UIView)->MotionObservable<CGPoint>letstateStream:MotionObservable<UIGestureRecognizerState>letstate:ReactiveProperty<MotionState>// .active when .began/.changed, .atRest otherwiseletenabled:ReactiveProperty<Bool>// Maps to the gesture recognizer's enabled propertyfunc add(to property:ReactiveProperty<CGPoint>,...)}letpan=PanGesture()// Like Draggable. Draggable might compose out to this interaction as a convenience API for making views draggable.
runtime.add(pan, to: runtime.get(view.layer).position)// Getting final velocity:letdidEnd= pan.stateStream.rewrite([.ended: true], otherwise: false)letvelocityOnRelease= pan.velocityStream(in: someView).valve(openWhenTrue: didEnd)
runtime.connect(velocityOnRelease, to: spring.initialVelocity)
The text was updated successfully, but these errors were encountered:
Gesture recognizers currently emit themselves along the stream's next channel, meaning we need operators like
whenRecognitionStateIs
andtranslationIn
in order to extract values from the object.I'd like to make gesture streams closer in shape to spring/tween streams in that they'd have specific streams for translation and velocity that could be subscribed to. For example, an API for a gesture recognizer interaction might look like so:
The text was updated successfully, but these errors were encountered: