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

Commit

Permalink
Rename map to rewrite.
Browse files Browse the repository at this point in the history
Reviewers: O4 Material Apple platform reviewers, #material_motion, O2 Material Motion, appsforartists

Reviewed By: #material_motion, O2 Material Motion, appsforartists

Tags: #material_motion

Differential Revision: http://codereview.cc/D2527
  • Loading branch information
jverkoey committed Jan 23, 2017
1 parent b77f535 commit 728805f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/SwipeExample.swift
Expand Up @@ -59,15 +59,15 @@ class TossableStackedCard: Interaction {
whenAbove: TossDirection.right),
to: tossDirection)

let destinationStream = tossDirection.map([
let destinationStream = tossDirection.rewrite([
.none: containerView.bounds.midX,
.left: -view.bounds.width,
.right: containerView.bounds.width + view.bounds.width
]
)
runtime.write(destinationStream, to: attachment.spring.destination)

let gestureEnabledStream = tossDirection.map([
let gestureEnabledStream = tossDirection.rewrite([
.none: true,
.left: false,
.right: false
Expand Down
2 changes: 1 addition & 1 deletion src/operators/map.swift → src/operators/rewrite.swift
Expand Up @@ -19,7 +19,7 @@ import Foundation
extension ExtendableMotionObservable where T: Hashable {

/** Emits the mapped value for each incoming value, if one exists, otherwise emits nothing. */
public func map<U>(_ values: [T: U]) -> MotionObservable<U> {
public func rewrite<U>(_ values: [T: U]) -> MotionObservable<U> {
return _nextOperator { value, next in
if let mappedValue = values[value] {
next(mappedValue)
Expand Down

0 comments on commit 728805f

Please sign in to comment.