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

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Mar 29, 2017
2 parents 65580d6 + a5e1ffe commit e7f3825
Show file tree
Hide file tree
Showing 30 changed files with 623 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module: MaterialMotion
module_version: 1.0.0
module_version: 1.1.0
sdk: iphonesimulator
xcodebuild_arguments:
- -workspace
- MaterialMotion.xcworkspace
- -scheme
- MaterialMotion
github_url: https://github.com/material-motion/material-motion-swift
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.0.0
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.1.0
140 changes: 140 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,143 @@
# 1.1.0

This is our first minor release. It includes two new interactions and improvements to APIs for the common cases.

<img src="assets/changedirection.gif" /><img src="assets/pulldowntodismiss.gif" />

## Behavioral changes

- TransitionSpring's configuration now defaults to Core Animation's default values. If you prefer to continue using the original Spring defaults you can use the following snippet:

```swift
spring.tension.value = defaultSpringTension
spring.friction.value = defaultSpringFriction
spring.mass.value = defaultSpringMass
spring.suggestedDuration.value = 0
```

## New deprecations

- Tossable's `init(system:draggable:)` is deprecated in favor of `init(spring:draggable:)`.

## New features

New interactions: `ChangeDirection` and `SlopRegion`.

Gesturable interactions can now be initialized with a sequence of gesture recognizers. This makes it easier to create gesturable interactions in transitions where the gesture recognizers are provided as a set.

Spring's system now defaults to Core Animation.

There is a new API for getting a gesture recognizer delegate that's able to coordinate a "drag to dismiss" transition with a vertical scroll view.

```swift
let pan = UIPanGestureRecognizer()
pan.delegate = transitionController.dismisser.topEdgeDismisserDelegate(for: scrollView)
```

## Source changes

* [Store interactions before adding them so that order is maintained when interactions add other interactions.](https://github.com/material-motion/material-motion-swift/commit/5d0af5fa77b913c0706837d1f0bbf3e14ce9f1ad) (Jeff Verkoeyen)
* [Avoid over-completion of chained property animations.](https://github.com/material-motion/material-motion-swift/commit/51ee058ddc3a15164f4a3c22c522cf3e6fd280c9) (Jeff Verkoeyen)
* [Fix bug causing properties-chained-to-properties to not animate correctly.](https://github.com/material-motion/material-motion-swift/commit/9e810bbf0ddce9764c76ea44dc223ccee4fca0b7) (Jeff Verkoeyen)
* [Add SlopRegion interaction.](https://github.com/material-motion/material-motion-swift/commit/2655adc561181c0679f52df2ca23646abf7876cb) (Jeff Verkoeyen)
* [Add topEdgeDismisserDelegate API to ViewControllerDismisser.](https://github.com/material-motion/material-motion-swift/commit/ad32ba9e7200b59e799d57c0c964b19be55089c3) (Jeff Verkoeyen)
* [Add Gesturable convenience initializer for extracting the first gesture recognizer from a sequence of gesture recognizers.](https://github.com/material-motion/material-motion-swift/commit/c4e0b3d0bf5c2b53e0046c08b63f0592b99b4b46) (Jeff Verkoeyen)
* [Rename ChangeDirectionOnRelease(of:) to ChangeDirection(withVelocityOf:)](https://github.com/material-motion/material-motion-swift/commit/c999a3a5134331e79f3cce74d2be222780155054) (Jeff Verkoeyen)
* [Fix crashing bug when connecting properties to one another.](https://github.com/material-motion/material-motion-swift/commit/840d97cd68321dd241e157ed9527cdc83ed73489) (Jeff Verkoeyen)
* [Add ChangeDirectionOnRelease interaction.](https://github.com/material-motion/material-motion-swift/commit/bdee45533c68f2c98e7b543acf9e3589a783eb46) (Jeff Verkoeyen)
* [Make TransitionSpring and Spring T type conform to Subtractable so that coreAnimation can be set as the default system.](https://github.com/material-motion/material-motion-swift/commit/419327972893b92a4317e903ad933550d096a76f) (Jeff Verkoeyen)
* [TransitionSpring configuration now defaults to Core Animation configuration defaults.](https://github.com/material-motion/material-motion-swift/commit/295d64556048429a5ec6d7859a0ce8922b84a4fd) (Jeff Verkoeyen)

## API changes

Auto-generated by running:

apidiff origin/stable release-candidate swift MaterialMotion.xcworkspace MaterialMotion

### New global constants

*new* global var: `defaultTransitionSpringFriction`

*new* global var: `defaultTransitionSpringSuggestedDuration`

*new* global var: `defaultTransitionSpringTension`

*new* global var: `defaultTransitionSpringMass`

### New interactions

*new* class: `ChangeDirection`

*new* class: `SlopRegion`

### Modified interactions

#### Gesturable

Affects `Draggable`, `Rotatable`, and `Scalable`.

*new* method: `init(withFirstGestureIn:)` in `Gesturable`

#### Spring

| Type of change: | Declaration |
|---|---|
| From: | `public class Spring<T> : Interaction, Togglable, Stateful where T : Zeroable` |
| To: | `public class Spring<T> : Interaction, Togglable, Stateful where T : Subtractable, T : Zeroable` |

*modified* method: `init(threshold:system:)` in `Spring`

| Type of change: | Declaration |
|---|---|
| From: | `public init(threshold: CGFloat, system: @escaping SpringToStream<T>)` |
| To: | `public init(threshold: CGFloat = 1, system: @escaping SpringToStream<T> = coreAnimation)` |

#### Tossable

*modified* method: `init(spring:draggable:)` in `Tossable`

| Type of change: | Declaration |
|---|---|
| From: | `public init(spring: Spring<CGPoint>, draggable: Draggable = Draggable())` |
| To: | `public init(spring: Spring<CGPoint> = Spring(), draggable: Draggable = Draggable())` |

*deprecated* method: `init(system:draggable:)` in `Tossable`. Use `init(spring:draggable:)` instead.

#### TransitionSpring

*modified* class: `TransitionSpring`

| Type of change: | Declaration |
|---|---|
| From: | `public final class TransitionSpring<T> : Spring<T> where T : Zeroable` |
| To: | `public final class TransitionSpring<T> : Spring<T> where T : Subtractable, T : Zeroable` |

*modified* method: `init(back:fore:direction:threshold:system:)` in `TransitionSpring`

| Type of change: | Declaration |
|---|---|
| From: | `public init(back backwardDestination: T, fore forwardDestination: T, direction: ReactiveProperty<TransitionDirection>, threshold: CGFloat, system: @escaping SpringToStream<T>)` |
| To: | `public init(back backwardDestination: T, fore forwardDestination: T, direction: ReactiveProperty<TransitionDirection>, threshold: CGFloat = default, system: @escaping SpringToStream<T> = default)` |

### Transitions

#### ViewControllerDismisser

*new* method: `topEdgeDismisserDelegate(for:)` in `ViewControllerDismisser`

### Stream changes

*new* var: `onCompletion` in `CoreAnimationChannelAdd`

*removed* var: `onCompletion` in `CoreAnimationChannelAdd`

## Non-source changes

* [Modify the PushBackTransition example to use connected properties instead of multiple springs.](https://github.com/material-motion/material-motion-swift/commit/71f06c23ec9ef8f460ad48de6f6af540f1eec4c9) (Jeff Verkoeyen)
* [Simplify the interactive push back transition example.](https://github.com/material-motion/material-motion-swift/commit/b8620649aae2eadf93ec66c82b164759a067931d) (Jeff Verkoeyen)
* [Add syntax highlighting languages to the README.](https://github.com/material-motion/material-motion-swift/commit/486cff7dc497a66c5479f8117a599cf778fa575a) (Jeff Verkoeyen)
* [Add example Podfile to the README.](https://github.com/material-motion/material-motion-swift/commit/687e6cc01dc82bd114a5f4f913cee54dc5071806) (Jeff Verkoeyen)

# 1.0.0

Initial stable release of Material Motion. Includes:
Expand Down
2 changes: 1 addition & 1 deletion MaterialMotion.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "MaterialMotion"
s.summary = "Reactive motion driven by Core Animation."
s.version = "1.0.0"
s.version = "1.1.0"
s.authors = "The Material Motion Authors"
s.license = "Apache 2.0"
s.homepage = "https://github.com/material-motion/material-motion-swift"
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PODS:
- IndefiniteObservable (3.1.0):
- IndefiniteObservable/lib (= 3.1.0)
- IndefiniteObservable/lib (3.1.0)
- MaterialMotion (1.0.0):
- MaterialMotion (1.1.0):
- IndefiniteObservable (~> 3.0)

DEPENDENCIES:
Expand All @@ -17,7 +17,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
CatalogByConvention: be55c2263132e4f9f59299ac8a528ee8715b3275
IndefiniteObservable: 2789d61f487d8d37fa2b9c3153cc44d4447ff744
MaterialMotion: 967eed88a2f4add305ea8768bbc49283283c1e83
MaterialMotion: 6ee4d44d39b074686d603c26c20a5816afdb50cd

PODFILE CHECKSUM: f503265a0d60526a0d28c96dd4bdcfb40fb562fc

Expand Down
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ arcMove.from.value = <#from#>
arcMove.to.value = <#to#>
runtime.add(arcMove, to: <#view#>)</code></pre></td>
</tr>
<tr>
<td align="center"><img src="assets/changedirection.gif" /></td>
<td><pre><code class="language-swift">ChangeDirection</code></pre></td>
<td><pre><code class="language-swift">runtime.add(ChangeDirection(withVelocityOf: gesture),
to: <#view#>)</code></pre></td>
</tr>
<tr>
<td align="center"><img src="assets/directlymanipulable.gif" /></td>
<td><pre><code class="language-swift">DirectlyManipulable</code></pre></td>
Expand Down Expand Up @@ -91,17 +97,38 @@ runtime.add(tossable, to: <#view#>)</code></pre></td>
Add `MaterialMotion` to your `Podfile`:

pod 'MaterialMotion'
```ruby
pod 'MaterialMotion'
```

You will need to add `use_frameworks!` to your Podfile in order use Material Motion in your swift
app.

A simple Podfile might look like so:

```ruby
project 'MyApp/MyApp.xcodeproj'

use_frameworks!

target 'MyApp' do
pod 'MaterialMotion'
end
```

Then run the following command:

pod install
```bash
pod install
```

### Usage

Import the framework:

import MaterialMotion
```swift
import MaterialMotion
```

You will now have access to all of the APIs.

Expand All @@ -110,10 +137,12 @@ You will now have access to all of the APIs.
Check out a local copy of the repo to access the Catalog application by running the following
commands:

git clone https://github.com/material-motion/material-motion-swift.git
cd material-motion-swift
pod install
open MaterialMotion.xcworkspace
```bash
git clone https://github.com/material-motion/material-motion-swift.git
cd material-motion-swift
pod install
open MaterialMotion.xcworkspace
```

## Case studies

Expand Down Expand Up @@ -168,6 +197,16 @@ Makes use of: `Tossable` and `TransitionSpring`.

[View the source](examples/ModalDialogExample.swift).

### Pull down to dismiss

<img src="assets/pulldowntodismiss.gif" />

A modal scroll view controller that can be dismissed with a drag gesture.

Makes use of: `Tossable` and `TransitionSpring`.

[View the source](examples/InteractivePushBackTransitionExample.swift).

### Sticker picker

<img src="assets/stickerpicker.gif" />
Expand Down
Binary file added assets/changedirection.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pulldowntodismiss.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions examples/ChangeDirectionOnReleaseExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Copyright 2016-present The Material Motion Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import UIKit
import MaterialMotion

class ChangeDirectionOnReleaseExampleViewController: ExampleViewController {

var runtime: MotionRuntime!

override func viewDidLoad() {
super.viewDidLoad()

let targetView = center(createExampleSquareView(), within: view)
targetView.layer.borderColor = targetView.backgroundColor?.cgColor
targetView.layer.borderWidth = 1
targetView.backgroundColor = nil
view.addSubview(targetView)

let exampleView = center(createExampleView(), within: view)
view.addSubview(exampleView)

runtime = MotionRuntime(containerView: view)

let direction = createProperty(withInitialValue: TransitionDirection.backward)

let positionSpring = TransitionSpring(back: CGPoint(x: view.bounds.midX, y: view.bounds.height * 4 / 10),
fore: CGPoint(x: view.bounds.midX, y: view.bounds.height * 6 / 10),
direction: direction)
let tossable = Tossable(spring: positionSpring)
runtime.add(ChangeDirection(withVelocityOf: tossable.draggable.nextGestureRecognizer,
whenNegative: .backward,
whenPositive: .forward),
to: direction)
runtime.add(tossable, to: exampleView)
runtime.add(positionSpring, to: runtime.get(targetView.layer).position)
}

override func exampleInformation() -> ExampleInfo {
return .init(title: type(of: self).catalogBreadcrumbs().last!,
instructions: "Toss the view to change its position.")
}
}
Loading

0 comments on commit e7f3825

Please sign in to comment.