Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
3972e840
Unverified
Commit
3972e840
authored
Apr 08, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated relationship between enabling interactive motion and non interactive motion transitions
parent
56527435
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
29 deletions
+56
-29
Sources/iOS/Material+Motion.swift
+56
-29
No files found.
Sources/iOS/Material+Motion.swift
View file @
3972e840
...
...
@@ -121,7 +121,6 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
set
(
value
)
{
if
value
{
prepareMotionDelegation
()
motionInstanceController
.
isInteractiveMotionEnabled
=
false
}
motionInstanceController
.
isMotionEnabled
=
value
...
...
@@ -136,7 +135,7 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
set
(
value
)
{
if
value
{
prepareMotionDelegation
()
motionInstanceController
.
isMotionEnabled
=
fals
e
motionInstanceController
.
isMotionEnabled
=
tru
e
}
motionInstanceController
.
isInteractiveMotionEnabled
=
value
...
...
@@ -155,31 +154,6 @@ extension UIViewController: MotionDelegate, UIViewControllerTransitioningDelegat
}
extension
UIViewController
{
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ navigationController: A UINavigationController.
- Parameter animationControllerFor operation: A UINavigationControllerOperation.
- Parameter from fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
)
:
nil
}
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ tabBarController: A UITabBarController.
- Parameter animationControllerForTransitionFrom fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
)
:
nil
}
}
extension
UIViewController
{
/// Prepares the motionDelegate.
fileprivate
func
prepareMotionDelegation
()
{
modalPresentationStyle
=
.
custom
...
...
@@ -199,6 +173,7 @@ extension UIViewController {
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"animationController(forPresented"
)
return
isMotionEnabled
?
PresentingMotion
(
isPresenting
:
true
)
:
nil
}
...
...
@@ -208,6 +183,7 @@ extension UIViewController {
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"animationController(forDismissed"
)
return
isMotionEnabled
?
DismissingMotion
(
isPresenting
:
true
)
:
nil
}
...
...
@@ -219,15 +195,45 @@ extension UIViewController {
- Returns: An optional UIPresentationController.
*/
open
func
presentationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
?,
source
:
UIViewController
)
->
UIPresentationController
?
{
print
(
"presentationController:forPresented"
)
return
isMotionEnabled
?
MotionPresentationController
(
presentedViewController
:
presented
,
presenting
:
presenting
)
:
nil
}
open
func
interactionControllerForPresentation
(
using
animator
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
return
isInteractiveMotionEnabled
?
InteractivePresentingMotion
()
:
nil
print
(
"interactionControllerForPresentation"
)
return
isInteractiveMotionEnabled
?
InteractivePresentingMotion
(
animator
:
animator
)
:
nil
}
open
func
interactionControllerForDismissal
(
using
animator
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
return
isInteractiveMotionEnabled
?
InteractiveDismissingMotion
()
:
nil
print
(
"interactionControllerForDismissal"
)
return
isInteractiveMotionEnabled
?
InteractiveDismissingMotion
(
animator
:
animator
)
:
nil
}
}
extension
UIViewController
{
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ navigationController: A UINavigationController.
- Parameter animationControllerFor operation: A UINavigationControllerOperation.
- Parameter from fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"navigationController(_ navigationController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
operation
==
.
push
)
:
nil
}
/**
Determines whether to use a Motion instance for transitions.
- Parameter _ tabBarController: A UITabBarController.
- Parameter animationControllerForTransitionFrom fromVC: A UIViewController that is being transitioned from.
- Parameter to toVC: A UIViewController that is being transitioned to.
- Returns: An optional UIViewControllerAnimatedTransitioning.
*/
open
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
print
(
"tabBarController(_ tabBarController"
)
return
fromVC
.
isMotionEnabled
?
Motion
(
isPresenting
:
true
)
:
nil
}
}
...
...
@@ -865,6 +871,16 @@ open class DismissingMotion: Motion {
}
open
class
InteractiveMotion
:
UIPercentDrivenInteractiveTransition
{
/// A reference to the view controller that is being transitioned to.
open
var
toViewController
:
UIViewController
{
return
transitionContext
.
viewController
(
forKey
:
.
to
)
!
}
/// A reference to the view controller that is being transitioned from.
open
var
fromViewController
:
UIViewController
{
return
transitionContext
.
viewController
(
forKey
:
.
from
)
!
}
/// The transition context for the current transition.
open
fileprivate
(
set
)
var
transitionContext
:
UIViewControllerContextTransitioning
!
...
...
@@ -874,6 +890,17 @@ open class InteractiveMotion: UIPercentDrivenInteractiveTransition {
/// The transition container view.
open
fileprivate
(
set
)
var
containerView
:
UIView
!
open
fileprivate
(
set
)
var
animator
:
UIViewControllerAnimatedTransitioning
!
/**
An initializer that accepts an animator object.
- Parameter animator: UIViewControllerAnimatedTransitioning.
*/
public
init
(
animator
:
UIViewControllerAnimatedTransitioning
)
{
super
.
init
()
self
.
animator
=
animator
}
open
override
func
startInteractiveTransition
(
_
transitionContext
:
UIViewControllerContextTransitioning
)
{
super
.
startInteractiveTransition
(
transitionContext
)
self
.
transitionContext
=
transitionContext
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment