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

Commit

Permalink
Rename runtime.disable to runtime.toggle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Mar 17, 2017
1 parent 452888c commit 0bf4c14
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/ContextualTransitionExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private class PushBackTransition: Transition {
runtime.add(tossable, to: replicaView)

let size = spring(back: contextView.bounds.size, fore: fitSize, threshold: 1, ctx: ctx)
runtime.disable(size, whenActive: gesture)
runtime.toggle(size, inReactionTo: draggable)
runtime.add(size, to: runtime.get(replicaView).reactiveLayer.size)

let opacity = spring(back: CGFloat(0), fore: CGFloat(1), threshold: 0.01, ctx: ctx)
Expand Down
2 changes: 1 addition & 1 deletion examples/InteractivePushBackTransitionExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private class PushBackTransition: Transition {
let tossable = Tossable(spring: movement, draggable: draggable)
runtime.add(tossable, to: ctx.fore.view) { $0.xLocked(to: ctx.fore.view.layer.position.x) }

runtime.disable(scaleSpring, whenActive: gesture)
runtime.toggle(scaleSpring, inReactionTo: draggable)
runtime.add(scaleSpring, to: scale)

return [tossable.spring, scaleSpring, gesture]
Expand Down
2 changes: 1 addition & 1 deletion src/MotionRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public final class MotionRuntime {
This is most commonly used to disable a spring when a gestural interaction is active.
*/
public func disable(_ interaction: Togglable, whenActive otherInteraction: Stateful) {
public func toggle(_ interaction: Togglable, inReactionTo otherInteraction: Stateful) {
connect(otherInteraction.state.rewrite([.atRest: true, .active: false]), to: interaction.enabled)
}

Expand Down
2 changes: 1 addition & 1 deletion src/interactions/Tossable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class Tossable: Interaction, Stateful {
aggregateState.observe(state: spring.state, withRuntime: runtime)

runtime.connect(gesture.velocityOnReleaseStream(in: runtime.containerView), to: spring.initialVelocity)
runtime.disable(spring, whenActive: gesture)
runtime.toggle(spring, inReactionTo: draggable)
runtime.add(spring, to: position, constraints: constraints)

runtime.add(draggable, to: view, constraints: constraints)
Expand Down

0 comments on commit 0bf4c14

Please sign in to comment.