This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #31. This is a breaking change due to removal of APIs and changing of nullability annotations on existing APIs. This PR allows a client to associate multiple `Transition` instances with a single view controller transition. When a transition is initiated, each `Transition` instance will be provided the same transition context. This allows us to build smaller transition types, such as "FadeTransition" or "SlideTransition" which each accept a target view. These transitions can then be combined to create a "slide and fade in transition" like so: ```swift modalViewController.transitionController.transitions = [ FadeTransition(target: .foreView), SlideUpTransition(target: .foreView) ] ``` Some open questions this change has introduced: - How does view duplication work across transitions? Ideally if a view were duplicated by one transition it would not be re-duplicated by another, but ensuring that all transitions access views in a safe manner would require adoption of a convention, e.g. `context.resolvedView(for: view)`, which would be routed through a shared view duplicator. - Who is responsible for associating transitions with a given view controller transition? There are potentially three actors who might be interested in associating Interaction instances. This topic is discussed in #39. - How might a client easily build a transition that is composed of other transitions? This may warrant a follow-up feature change, possibly with the introduction of a `TransitionWithChildTransitions` protocol that allows the parent transition to return an array of child transitions.
- Loading branch information
Showing
21 changed files
with
735 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2017-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 MotionTransitioning | ||
|
||
// A potential target for a transition's motion. | ||
enum TransitionTarget { | ||
case backView | ||
case foreView | ||
case target(UIView) | ||
|
||
func resolve(with context: TransitionContext) -> UIView { | ||
switch self { | ||
case .backView: | ||
return context.backViewController.view | ||
case .foreView: | ||
return context.foreViewController.view | ||
case .target(let view): | ||
return view | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.