Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Rename translated to translation(addedTo:).
Browse files Browse the repository at this point in the history
Summary: Closes #33

Reviewers: O2 Material Motion, O4 Material Apple platform reviewers, #material_motion, chuga

Reviewed By: O4 Material Apple platform reviewers, chuga

Tags: #material_motion

Differential Revision: http://codereview.cc/D2865
  • Loading branch information
jverkoey committed Mar 13, 2017
1 parent 9e18efb commit 3690510
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/SwipeExample.swift
Expand Up @@ -75,7 +75,7 @@ class TossableStackedCard: Interaction {
runtime.connect(drag.velocityOnReleaseStream(in: view).x(), to: attachment.initialVelocity)
runtime.connect(destination, to: attachment.destination)

let draggable = drag.translated(from: reactiveView.center, in: relativeView).x()
let draggable = drag.translation(addedTo: reactiveView.center, in: relativeView).x()
runtime.connect(draggable, to: reactiveView.centerX)
runtime.connect(drag.atRest(), to: attachment.enabled)
runtime.add(attachment, to: reactiveView.centerX)
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/Draggable.swift
Expand Up @@ -41,7 +41,7 @@ extension Draggable: Interaction {
let reactiveView = runtime.get(view)
let gestureRecognizer = dequeueGestureRecognizer(withReactiveView: reactiveView)
let position = reactiveView.reactiveLayer.position
var stream = runtime.get(gestureRecognizer).translated(from: position)
var stream = runtime.get(gestureRecognizer).translation(addedTo: position)
if let applyConstraints = applyConstraints {
stream = applyConstraints(stream)
}
Expand Down
Expand Up @@ -22,7 +22,7 @@ extension MotionObservableConvertible where T: UIPanGestureRecognizer {
Adds the current translation to the initial position and emits the result while the gesture
recognizer is active.
*/
public func translated<O: MotionObservableConvertible>(from initialPosition: O, in view: UIView) -> MotionObservable<CGPoint> where O.T == CGPoint {
public func translation<O: MotionObservableConvertible>(addedTo initialPosition: O, in view: UIView) -> MotionObservable<CGPoint> where O.T == CGPoint {
var cachedInitialPosition: CGPoint?
var lastInitialPosition: CGPoint?

Expand Down
4 changes: 2 additions & 2 deletions src/reactivetypes/ReactiveUIGestureRecognizer.swift
Expand Up @@ -56,8 +56,8 @@ extension ReactiveUIGestureRecognizer {

extension ReactiveUIGestureRecognizer where O: UIPanGestureRecognizer {

public func translated<O: MotionObservableConvertible>(from initialPosition: O) -> MotionObservable<CGPoint> where O.T == CGPoint {
return stream.whenRecognitionState(isAnyOf: [.began, .changed]).translated(from: initialPosition, in: containerView)
public func translation<O: MotionObservableConvertible>(addedTo initialPosition: O) -> MotionObservable<CGPoint> where O.T == CGPoint {
return stream.whenRecognitionState(isAnyOf: [.began, .changed]).translation(addedTo: initialPosition, in: containerView)
}
public func velocityOnReleaseStream() -> MotionObservable<CGPoint> {
return stream.whenRecognitionState(is: .ended).velocity(in: containerView)
Expand Down

0 comments on commit 3690510

Please sign in to comment.