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

Commit e7f3825

Browse files
author
Jeff Verkoeyen
committed
Merge branch 'release-candidate' into stable
2 parents 65580d6 + a5e1ffe commit e7f3825

30 files changed

+623
-177
lines changed

.jazzy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module: MaterialMotion
2-
module_version: 1.0.0
2+
module_version: 1.1.0
33
sdk: iphonesimulator
44
xcodebuild_arguments:
55
- -workspace
66
- MaterialMotion.xcworkspace
77
- -scheme
88
- MaterialMotion
99
github_url: https://github.com/material-motion/material-motion-swift
10-
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.0.0
10+
github_file_prefix: https://github.com/material-motion/material-motion-swift/tree/v1.1.0

CHANGELOG.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,143 @@
1+
# 1.1.0
2+
3+
This is our first minor release. It includes two new interactions and improvements to APIs for the common cases.
4+
5+
<img src="assets/changedirection.gif" /><img src="assets/pulldowntodismiss.gif" />
6+
7+
## Behavioral changes
8+
9+
- 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:
10+
11+
```swift
12+
spring.tension.value = defaultSpringTension
13+
spring.friction.value = defaultSpringFriction
14+
spring.mass.value = defaultSpringMass
15+
spring.suggestedDuration.value = 0
16+
```
17+
18+
## New deprecations
19+
20+
- Tossable's `init(system:draggable:)` is deprecated in favor of `init(spring:draggable:)`.
21+
22+
## New features
23+
24+
New interactions: `ChangeDirection` and `SlopRegion`.
25+
26+
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.
27+
28+
Spring's system now defaults to Core Animation.
29+
30+
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.
31+
32+
```swift
33+
let pan = UIPanGestureRecognizer()
34+
pan.delegate = transitionController.dismisser.topEdgeDismisserDelegate(for: scrollView)
35+
```
36+
37+
## Source changes
38+
39+
* [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)
40+
* [Avoid over-completion of chained property animations.](https://github.com/material-motion/material-motion-swift/commit/51ee058ddc3a15164f4a3c22c522cf3e6fd280c9) (Jeff Verkoeyen)
41+
* [Fix bug causing properties-chained-to-properties to not animate correctly.](https://github.com/material-motion/material-motion-swift/commit/9e810bbf0ddce9764c76ea44dc223ccee4fca0b7) (Jeff Verkoeyen)
42+
* [Add SlopRegion interaction.](https://github.com/material-motion/material-motion-swift/commit/2655adc561181c0679f52df2ca23646abf7876cb) (Jeff Verkoeyen)
43+
* [Add topEdgeDismisserDelegate API to ViewControllerDismisser.](https://github.com/material-motion/material-motion-swift/commit/ad32ba9e7200b59e799d57c0c964b19be55089c3) (Jeff Verkoeyen)
44+
* [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)
45+
* [Rename ChangeDirectionOnRelease(of:) to ChangeDirection(withVelocityOf:)](https://github.com/material-motion/material-motion-swift/commit/c999a3a5134331e79f3cce74d2be222780155054) (Jeff Verkoeyen)
46+
* [Fix crashing bug when connecting properties to one another.](https://github.com/material-motion/material-motion-swift/commit/840d97cd68321dd241e157ed9527cdc83ed73489) (Jeff Verkoeyen)
47+
* [Add ChangeDirectionOnRelease interaction.](https://github.com/material-motion/material-motion-swift/commit/bdee45533c68f2c98e7b543acf9e3589a783eb46) (Jeff Verkoeyen)
48+
* [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)
49+
* [TransitionSpring configuration now defaults to Core Animation configuration defaults.](https://github.com/material-motion/material-motion-swift/commit/295d64556048429a5ec6d7859a0ce8922b84a4fd) (Jeff Verkoeyen)
50+
51+
## API changes
52+
53+
Auto-generated by running:
54+
55+
apidiff origin/stable release-candidate swift MaterialMotion.xcworkspace MaterialMotion
56+
57+
### New global constants
58+
59+
*new* global var: `defaultTransitionSpringFriction`
60+
61+
*new* global var: `defaultTransitionSpringSuggestedDuration`
62+
63+
*new* global var: `defaultTransitionSpringTension`
64+
65+
*new* global var: `defaultTransitionSpringMass`
66+
67+
### New interactions
68+
69+
*new* class: `ChangeDirection`
70+
71+
*new* class: `SlopRegion`
72+
73+
### Modified interactions
74+
75+
#### Gesturable
76+
77+
Affects `Draggable`, `Rotatable`, and `Scalable`.
78+
79+
*new* method: `init(withFirstGestureIn:)` in `Gesturable`
80+
81+
#### Spring
82+
83+
| Type of change: | Declaration |
84+
|---|---|
85+
| From: | `public class Spring<T> : Interaction, Togglable, Stateful where T : Zeroable` |
86+
| To: | `public class Spring<T> : Interaction, Togglable, Stateful where T : Subtractable, T : Zeroable` |
87+
88+
*modified* method: `init(threshold:system:)` in `Spring`
89+
90+
| Type of change: | Declaration |
91+
|---|---|
92+
| From: | `public init(threshold: CGFloat, system: @escaping SpringToStream<T>)` |
93+
| To: | `public init(threshold: CGFloat = 1, system: @escaping SpringToStream<T> = coreAnimation)` |
94+
95+
#### Tossable
96+
97+
*modified* method: `init(spring:draggable:)` in `Tossable`
98+
99+
| Type of change: | Declaration |
100+
|---|---|
101+
| From: | `public init(spring: Spring<CGPoint>, draggable: Draggable = Draggable())` |
102+
| To: | `public init(spring: Spring<CGPoint> = Spring(), draggable: Draggable = Draggable())` |
103+
104+
*deprecated* method: `init(system:draggable:)` in `Tossable`. Use `init(spring:draggable:)` instead.
105+
106+
#### TransitionSpring
107+
108+
*modified* class: `TransitionSpring`
109+
110+
| Type of change: | Declaration |
111+
|---|---|
112+
| From: | `public final class TransitionSpring<T> : Spring<T> where T : Zeroable` |
113+
| To: | `public final class TransitionSpring<T> : Spring<T> where T : Subtractable, T : Zeroable` |
114+
115+
*modified* method: `init(back:fore:direction:threshold:system:)` in `TransitionSpring`
116+
117+
| Type of change: | Declaration |
118+
|---|---|
119+
| From: | `public init(back backwardDestination: T, fore forwardDestination: T, direction: ReactiveProperty<TransitionDirection>, threshold: CGFloat, system: @escaping SpringToStream<T>)` |
120+
| To: | `public init(back backwardDestination: T, fore forwardDestination: T, direction: ReactiveProperty<TransitionDirection>, threshold: CGFloat = default, system: @escaping SpringToStream<T> = default)` |
121+
122+
### Transitions
123+
124+
#### ViewControllerDismisser
125+
126+
*new* method: `topEdgeDismisserDelegate(for:)` in `ViewControllerDismisser`
127+
128+
### Stream changes
129+
130+
*new* var: `onCompletion` in `CoreAnimationChannelAdd`
131+
132+
*removed* var: `onCompletion` in `CoreAnimationChannelAdd`
133+
134+
## Non-source changes
135+
136+
* [Modify the PushBackTransition example to use connected properties instead of multiple springs.](https://github.com/material-motion/material-motion-swift/commit/71f06c23ec9ef8f460ad48de6f6af540f1eec4c9) (Jeff Verkoeyen)
137+
* [Simplify the interactive push back transition example.](https://github.com/material-motion/material-motion-swift/commit/b8620649aae2eadf93ec66c82b164759a067931d) (Jeff Verkoeyen)
138+
* [Add syntax highlighting languages to the README.](https://github.com/material-motion/material-motion-swift/commit/486cff7dc497a66c5479f8117a599cf778fa575a) (Jeff Verkoeyen)
139+
* [Add example Podfile to the README.](https://github.com/material-motion/material-motion-swift/commit/687e6cc01dc82bd114a5f4f913cee54dc5071806) (Jeff Verkoeyen)
140+
1141
# 1.0.0
2142

3143
Initial stable release of Material Motion. Includes:

MaterialMotion.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "MaterialMotion"
33
s.summary = "Reactive motion driven by Core Animation."
4-
s.version = "1.0.0"
4+
s.version = "1.1.0"
55
s.authors = "The Material Motion Authors"
66
s.license = "Apache 2.0"
77
s.homepage = "https://github.com/material-motion/material-motion-swift"

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PODS:
33
- IndefiniteObservable (3.1.0):
44
- IndefiniteObservable/lib (= 3.1.0)
55
- IndefiniteObservable/lib (3.1.0)
6-
- MaterialMotion (1.0.0):
6+
- MaterialMotion (1.1.0):
77
- IndefiniteObservable (~> 3.0)
88

99
DEPENDENCIES:
@@ -17,7 +17,7 @@ EXTERNAL SOURCES:
1717
SPEC CHECKSUMS:
1818
CatalogByConvention: be55c2263132e4f9f59299ac8a528ee8715b3275
1919
IndefiniteObservable: 2789d61f487d8d37fa2b9c3153cc44d4447ff744
20-
MaterialMotion: 967eed88a2f4add305ea8768bbc49283283c1e83
20+
MaterialMotion: 6ee4d44d39b074686d603c26c20a5816afdb50cd
2121

2222
PODFILE CHECKSUM: f503265a0d60526a0d28c96dd4bdcfb40fb562fc
2323

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ arcMove.from.value = <#from#>
2929
arcMove.to.value = <#to#>
3030
runtime.add(arcMove, to: <#view#>)</code></pre></td>
3131
</tr>
32+
<tr>
33+
<td align="center"><img src="assets/changedirection.gif" /></td>
34+
<td><pre><code class="language-swift">ChangeDirection</code></pre></td>
35+
<td><pre><code class="language-swift">runtime.add(ChangeDirection(withVelocityOf: gesture),
36+
to: <#view#>)</code></pre></td>
37+
</tr>
3238
<tr>
3339
<td align="center"><img src="assets/directlymanipulable.gif" /></td>
3440
<td><pre><code class="language-swift">DirectlyManipulable</code></pre></td>
@@ -91,17 +97,38 @@ runtime.add(tossable, to: <#view#>)</code></pre></td>
9197
9298
Add `MaterialMotion` to your `Podfile`:
9399

94-
pod 'MaterialMotion'
100+
```ruby
101+
pod 'MaterialMotion'
102+
```
103+
104+
You will need to add `use_frameworks!` to your Podfile in order use Material Motion in your swift
105+
app.
106+
107+
A simple Podfile might look like so:
108+
109+
```ruby
110+
project 'MyApp/MyApp.xcodeproj'
111+
112+
use_frameworks!
113+
114+
target 'MyApp' do
115+
pod 'MaterialMotion'
116+
end
117+
```
95118

96119
Then run the following command:
97120

98-
pod install
121+
```bash
122+
pod install
123+
```
99124

100125
### Usage
101126

102127
Import the framework:
103128

104-
import MaterialMotion
129+
```swift
130+
import MaterialMotion
131+
```
105132

106133
You will now have access to all of the APIs.
107134

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

113-
git clone https://github.com/material-motion/material-motion-swift.git
114-
cd material-motion-swift
115-
pod install
116-
open MaterialMotion.xcworkspace
140+
```bash
141+
git clone https://github.com/material-motion/material-motion-swift.git
142+
cd material-motion-swift
143+
pod install
144+
open MaterialMotion.xcworkspace
145+
```
117146

118147
## Case studies
119148

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

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

200+
### Pull down to dismiss
201+
202+
<img src="assets/pulldowntodismiss.gif" />
203+
204+
A modal scroll view controller that can be dismissed with a drag gesture.
205+
206+
Makes use of: `Tossable` and `TransitionSpring`.
207+
208+
[View the source](examples/InteractivePushBackTransitionExample.swift).
209+
171210
### Sticker picker
172211

173212
<img src="assets/stickerpicker.gif" />

assets/changedirection.gif

189 KB
Loading

assets/pulldowntodismiss.gif

88.4 KB
Loading
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
Copyright 2016-present The Material Motion Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import UIKit
18+
import MaterialMotion
19+
20+
class ChangeDirectionOnReleaseExampleViewController: ExampleViewController {
21+
22+
var runtime: MotionRuntime!
23+
24+
override func viewDidLoad() {
25+
super.viewDidLoad()
26+
27+
let targetView = center(createExampleSquareView(), within: view)
28+
targetView.layer.borderColor = targetView.backgroundColor?.cgColor
29+
targetView.layer.borderWidth = 1
30+
targetView.backgroundColor = nil
31+
view.addSubview(targetView)
32+
33+
let exampleView = center(createExampleView(), within: view)
34+
view.addSubview(exampleView)
35+
36+
runtime = MotionRuntime(containerView: view)
37+
38+
let direction = createProperty(withInitialValue: TransitionDirection.backward)
39+
40+
let positionSpring = TransitionSpring(back: CGPoint(x: view.bounds.midX, y: view.bounds.height * 4 / 10),
41+
fore: CGPoint(x: view.bounds.midX, y: view.bounds.height * 6 / 10),
42+
direction: direction)
43+
let tossable = Tossable(spring: positionSpring)
44+
runtime.add(ChangeDirection(withVelocityOf: tossable.draggable.nextGestureRecognizer,
45+
whenNegative: .backward,
46+
whenPositive: .forward),
47+
to: direction)
48+
runtime.add(tossable, to: exampleView)
49+
runtime.add(positionSpring, to: runtime.get(targetView.layer).position)
50+
}
51+
52+
override func exampleInformation() -> ExampleInfo {
53+
return .init(title: type(of: self).catalogBreadcrumbs().last!,
54+
instructions: "Toss the view to change its position.")
55+
}
56+
}

0 commit comments

Comments
 (0)