This major release of Material Motion focuses includes improvements to the transitioning architecture, the reactive architecture, and new features on many of the interactions.
Breaking changes
• The IndefiniteObservable
dependency has been bumped to 4.0.0. View the release notes.
• The Metadata
and Inspectable
types have been removed from Material Motion. All related APIs have been simplified accordingly.
• The MotionRuntime.toGraphViz
API has been removed. There is no replacement API.
• Tossable
's init(system:draggable:)
has been removed. Use init(spring:draggable:)
instead.
• SelfDismissingTransition
's willPresent(fore:dismisser:)
is no longer a static method. Implement the method as an instance method instead.
• Transition
is now a class protocol. This means that only object-types can conform to Transition
.
• TransitionController
's dismisser
has been removed. All methods have been moved directly to the TransitionController object.
• Tween
's keyPositions
has been removed. Use offsets
instead.
• MotionRuntime
's interactions(for:filter:)
has been removed. Use interactions(ofType:for:)
instead.
New features
Reactive architecture
• Subscriptions no longer automatically unsubscribe when the Subscription object is released. Subscriptions will stay active for as long as the head of the stream is alive.
• Reactive types are now global and shared across all instances of MotionRuntime. You can use Reactive(object)
to fetch a cached reactive version of a supported type.
• MotionRuntime now supports a .get
for UISlider instances. This will return an Observable of the slider's value.
• New operator ignoreUntil
.
• New reactive variant of operator rubberBanded(outsideOf:maxLength:)
.
• New operator for float types toString(format:)
.
• New ReactiveScrollViewDelegate
API turns UIScrollViewDelegate events into observable streams.
For example, the delegate itself is an observable on the scroll view's content offset:
let delegate = ReactiveScrollViewDelegate()
scrollView.delegate = delegate
delegate.x().subscribeToValue { contentOffset in
print(contentOffset)
}
• New ReactiveButtonTarget
API for building reactive UIButtons.
• MotionRuntime
has a new API start(_:when:is:)
for starting interactions when another interaction reaches a given state.
• MotionRuntime
has a new isBeingManipulated
stream. This stream emits true when any Manipulable
interaction becomes active and false when all Manipulable
interactions come to rest.
Interactions
• MotionRuntime
now has a new isBeingManipulated
property that indicates whether any manipulation interaction is active.
Any interaction that conforms to the new Manipulation
type will affect the runtime's isBeingManipulated
property.
• Draggable
now has a resistance
property that can be used to create drag resistance beyond a draggable region.
draggable.resistance.perimeter.value = someRect
• Tween
has new properties for creating repeating animations: repeatCount
, repeatDuration
, and autoreverses
.
These properties directly map to the corresponding properties in Core Animation.
• TransitionTween
has new initializer values delayBefore
and delayAfter
.
delayBefore
is the delay used when transitioning forward. delayAfter
is the delay used when transitioning backward.
• The gesture property for gesture-based interactions is now optional. When nil, the interaction will do nothing.
This is primarily useful when building transitions that have optional interactivity.
Transitions
• New TransitionWithFallback
protocol allows transitions to swap themselves out for another transition instance.
• New TransitionWithPresentation
protocol allows transitions to customize their presentation using an iOS presentation controller. See the modal dialog case study for an example of using this new functionality.
• New TransitionWithTermination
protocol allows transitions to perform cleanup logic at the end of a transition.
• TransitionContext
's gestureRecognizers
is now settable. This makes it possible to add arbitrary gesture recognizers to a transition.
Source changes
- Attempt to reduce the flakiness of the PropertiesNotReleasedWhenDereferenced test. (Jeff Verkoeyen)
- Move fallback calculations to later in the transition lifecycle. (Jeff Verkoeyen)
- Add a backgroundColor property to Reactive+CALayer. (Jeff Verkoeyen)
- Add a defaultModalPresentationStyle API for transitions with presentation. (Jeff Verkoeyen)
- Allow TransitionWithPresentation to return nil for conditional presentation. (Jeff Verkoeyen)
- Add support for fallback transitions. (Jeff Verkoeyen)
- Make TransitionWithPresentation's method an instance method. (Jeff Verkoeyen)
- Don't attempt to slow down CASpringAnimation animations when slow-motion animations is enabled. (Jeff Verkoeyen)
- Add support for pre/post delay to TransitionTween. (Jeff Verkoeyen)
- Also slow down the beginTime for tweens when simulator slow motion is enabled. (Jeff Verkoeyen)
- When emitting Tweens with a delay, set the fill mode to backward. (Jeff Verkoeyen)
- Resolve new Xcode 8.3.2 warnings. (Jeff Verkoeyen)
- Remove all deprecated APIs in preparation for major release. (Jeff Verkoeyen)
- Remove Metadata. (Jeff Verkoeyen)
- Rename keyPositions to offsets (Eric Tang)
- Add a reactive button target type and an initial isHighlighted stream. (Jeff Verkoeyen)
- Add format support to the toString operator for numerical types. (Jeff Verkoeyen)
- Add runtime.get for UISlider instances. (Jeff Verkoeyen)
- Add reactive UILabel type with text property. (Jeff Verkoeyen)
- When using a transition with presentation, use the .custom modal presentation style. (Jeff Verkoeyen)
- Allow transition types to be instantiated and stored on the transition controller. (Jeff Verkoeyen)
- Remove the foreAlignmentEdge property from the transition controller. (Jeff Verkoeyen)
- Add support for customizing transition presentation. (Jeff Verkoeyen)
- Avoid excessive TransitionTween emissions when the transition direction changes. (Jeff Verkoeyen)
- Added ignoreUntil and simplified slop (Eric Tang)
- Added unit test (Eric Tang)
- Swap params for runtime.interactions() API (Eric Tang)
- Fix build failure. (Jeff Verkoeyen)
- Add a ReactiveScrollViewDelegate and replace usage of the MotionRuntime in the carousel demo. (Jeff Verkoeyen)
- Mark all MotionObservable subscribe methods with @discardableResult. (Jeff Verkoeyen)
- Add a new Reactive type for querying reactive properties. (Jeff Verkoeyen)
- Shorten the delayBy test delay. (Jeff Verkoeyen)
- Added new start function to MotionRuntime (Eric Tang)
- Reduce flakiness of delay test. (Jeff Verkoeyen)
- Move Timeline to a timeline folder. (Jeff Verkoeyen)
- Bump IndefiniteObservable to 4.0 and add explicit unsubscriptions to the runtime. (Jeff Verkoeyen)
- Add repeat APIs to Tween (Eric Tang)
- Change runtime.interactions API to use an ofType: argument instead of a block. (Jeff Verkoeyen)
- Add a resistance property to Draggable. (Jeff Verkoeyen)
- Add a Manipulation type and implement UIKit view controller transitioning interactivity APIs. (Jeff Verkoeyen)
- View controllers are only interactive if at least one gesture recognizer is active. (Jeff Verkoeyen)
- Ensure that system animations take effect during view controller transitions. (Jeff Verkoeyen)
- Operators that use _map no longer transform velocity by default. (Jeff Verkoeyen)
- When no gesture recognizer is provided to a gestural interaction that expects one, the interaction now does nothing. (Jeff Verkoeyen)
- Fix build failure. (Jeff Verkoeyen)
- Add foreAlignmentEdge property to TransitionController. (Jeff Verkoeyen)
- Deprecate transitionController.dismisser and move the APIs into TransitionController. (Jeff Verkoeyen)
- Add missing imports. (Jeff Verkoeyen)
- Add missing Foundation import. (Jeff Verkoeyen)
- Add Togglable conformity to Rotatable and Scalable. (Jeff Verkoeyen)
API changes
Auto-generated by running:
apidiff origin/stable release-candidate swift MaterialMotion.xcworkspace MaterialMotion
Debugging
Inspectable
removed protocol: Inspectable
Metadata
removed class: Metadata
Interactions
Draggable
new var: resistance
in Draggable
modified class: Draggable
Type of change: | Declaration |
---|---|
From: | public final class Draggable : Gesturable<UIPanGestureRecognizer>, Interaction, Togglable, Stateful |
To: | public final class Draggable : Gesturable<UIPanGestureRecognizer>, Interaction, Togglable, Manipulation |
Manipulation
new protocol: Manipulation
Rotatable
modified class: Rotatable
Type of change: | Declaration |
---|---|
From: | public final class Rotatable : Gesturable<UIRotationGestureRecognizer>, Interaction, Togglable, Stateful |
To: | public final class Rotatable : Gesturable<UIRotationGestureRecognizer>, Interaction, Togglable, Manipulation |
Scalable
modified class: Scalable
Type of change: | Declaration |
---|---|
From: | public final class Scalable : Gesturable<UIPinchGestureRecognizer>, Interaction, Togglable, Stateful |
To: | public final class Scalable : Gesturable<UIPinchGestureRecognizer>, Interaction, Togglable, Manipulation |
Tossable
removed method: init(system:draggable:)
in Tossable
Tween
new var: offsets
in Tween
new var: repeatCount
in Tween
new var: repeatDuration
in Tween
new var: autoreverses
in Tween
removed var: keyPositions
in Tween
Reactive architecture
MotionObservableConvertible
new method: ignoreUntil(_:)
in MotionObservableConvertible
new method: rubberBanded(outsideOf:maxLength:)
in MotionObservableConvertible
new method: toString(format:)
in MotionObservableConvertible
MotionRuntime
new method: interactions(ofType:for:)
in MotionRuntime
new method: start(_:when:is:)
in MotionRuntime
new var: isBeingManipulated
in MotionRuntime
removed method: interactions(for:filter:)
in MotionRuntime
removed method: asGraphviz()
in MotionRuntime
ReactiveButtonTarget
new class: ReactiveButtonTarget
new var: didHighlight
in ReactiveButtonTarget
ReactiveUIView
removed class: ReactiveUIView
ReactiveCAShapeLayer
removed class: ReactiveCAShapeLayer
ReactiveScrollViewDelegate
new class: ReactiveScrollViewDelegate
Transitions
SelfDismissingTransition
new method: willPresent(fore:dismisser:)
in SelfDismissingTransition
removed static method: willPresent(fore:dismisser:)
in SelfDismissingTransition
Transition
removed method: init()
in Transition
modified protocol: Transition
Type of change: | Declaration |
---|---|
From: | public protocol Transition |
To: | public protocol Transition : class |
TransitionWithFallback
new protocol: TransitionWithFallback
new method: fallbackTansition(withContext:)
in TransitionWithFallback
TransitionWithPresentation
new protocol: TransitionWithPresentation
new method: presentationController(forPresented:presenting:source:)
in TransitionWithPresentation
new method: defaultModalPresentationStyle()
in TransitionWithPresentation
TransitionWithTermination
new protocol: TransitionWithTermination
new method: didEndTransition(withContext:runtime:)
in TransitionWithTermination
TransitionContext
modified var: gestureRecognizers
in TransitionContext
Type of change: | Declaration |
---|---|
From: | public var gestureRecognizers: Set<UIGestureRecognizer> { get } |
To: | public let gestureRecognizers: Set<UIGestureRecognizer> |
TransitionController
new method: disableSimultaneousRecognition(of:)
in TransitionController
new var: presentationController
in TransitionController
new method: topEdgeDismisserDelegate(for:)
in TransitionController
new var: gestureRecognizers
in TransitionController
new var: transition
in TransitionController
new var: gestureDelegate
in TransitionController
new method: dismissWhenGestureRecognizerBegins(_:)
in TransitionController
removed var: transitionType
in TransitionController
removed var: dismisser
in TransitionController
Non-source changes
- Update modal dialog example to make use of a presentation controller. (Jeff Verkoeyen)
- Update CocoaPods to 1.2.1. (Jeff Verkoeyen)
- Add Discord badge (Brenton Simpson)
- Remove use of Reactive type in carousel example. (Jeff Verkoeyen)
- Make both push back case studies use a light status bar in the modal view. (Jeff Verkoeyen)