Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Motion
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
Motion
Commits
fdf4c631
Commit
fdf4c631
authored
Dec 13, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Motion with states
parent
5a76e020
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
Sources/Animator/MotionAnimatorViewContext.swift
+1
-0
Sources/Animator/MotionCoreAnimator.swift
+1
-1
Sources/Motion.swift
+29
-6
No files found.
Sources/Animator/MotionAnimatorViewContext.swift
View file @
fdf4c631
...
@@ -93,6 +93,7 @@ internal class MotionAnimatorViewContext {
...
@@ -93,6 +93,7 @@ internal class MotionAnimatorViewContext {
or not.
or not.
- Returns: A TimeInterval.
- Returns: A TimeInterval.
*/
*/
@discardableResult
func
resume
(
at
elapsedTime
:
TimeInterval
,
isReversed
:
Bool
)
->
TimeInterval
{
func
resume
(
at
elapsedTime
:
TimeInterval
,
isReversed
:
Bool
)
->
TimeInterval
{
return
0
return
0
}
}
...
...
Sources/Animator/MotionCoreAnimator.swift
View file @
fdf4c631
...
@@ -33,7 +33,7 @@ class MotionCoreAnimator: MotionAnimator {
...
@@ -33,7 +33,7 @@ class MotionCoreAnimator: MotionAnimator {
/// A reference to the MotionContext.
/// A reference to the MotionContext.
public
var
context
:
MotionContext
!
{
public
var
context
:
MotionContext
!
{
return
motion
?
.
context
return
motion
.
context
}
}
func
clean
()
{}
func
clean
()
{}
...
...
Sources/Motion.swift
View file @
fdf4c631
...
@@ -220,9 +220,6 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
...
@@ -220,9 +220,6 @@ public class Motion: NSObject, MotionProgressRunnerDelegate {
/// Whether or not we are presenting the destination view controller.
/// Whether or not we are presenting the destination view controller.
public
internal(set)
var
isPresenting
=
true
public
internal(set)
var
isPresenting
=
true
/// Indicates whether the transition is animating or not.
public
internal(set)
var
isAnimating
=
false
/**
/**
A view container used to hold all the animating views during a
A view container used to hold all the animating views during a
transition.
transition.
...
@@ -530,6 +527,7 @@ public extension Motion {
...
@@ -530,6 +527,7 @@ public extension Motion {
return
return
}
}
state
=
.
notified
isPresenting
=
true
isPresenting
=
true
transitionContainer
=
view
transitionContainer
=
view
fromViewController
=
from
fromViewController
=
from
...
@@ -707,7 +705,7 @@ extension Motion: UIViewControllerAnimatedTransitioning {
...
@@ -707,7 +705,7 @@ extension Motion: UIViewControllerAnimatedTransitioning {
}
}
public
func
animationEnded
(
_
transitionCompleted
:
Bool
)
{
public
func
animationEnded
(
_
transitionCompleted
:
Bool
)
{
isAnimating
=
!
transitionCompleted
state
=
.
possible
}
}
}
}
...
@@ -718,13 +716,24 @@ extension Motion: UIViewControllerTransitioningDelegate {
...
@@ -718,13 +716,24 @@ extension Motion: UIViewControllerTransitioningDelegate {
}
}
public
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
public
func
animationController
(
forPresented
presented
:
UIViewController
,
presenting
:
UIViewController
,
source
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
guard
!
isTransitioning
else
{
return
nil
}
state
=
.
notified
isPresenting
=
true
isPresenting
=
true
fromViewController
=
fromViewController
??
presenting
fromViewController
=
fromViewController
??
presenting
toViewController
=
toViewController
??
presented
toViewController
=
toViewController
??
presented
return
self
return
self
}
}
public
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
public
func
animationController
(
forDismissed
dismissed
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
guard
!
isTransitioning
else
{
return
nil
}
state
=
.
notified
isPresenting
=
false
isPresenting
=
false
fromViewController
=
fromViewController
??
dismissed
fromViewController
=
fromViewController
??
dismissed
return
self
return
self
...
@@ -751,10 +760,16 @@ extension Motion: UIViewControllerInteractiveTransitioning {
...
@@ -751,10 +760,16 @@ extension Motion: UIViewControllerInteractiveTransitioning {
extension
Motion
:
UINavigationControllerDelegate
{
extension
Motion
:
UINavigationControllerDelegate
{
public
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
public
func
navigationController
(
_
navigationController
:
UINavigationController
,
animationControllerFor
operation
:
UINavigationControllerOperation
,
from
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
guard
!
isTransitioning
else
{
return
nil
}
state
=
.
notified
isPresenting
=
.
push
==
operation
isPresenting
=
.
push
==
operation
fromViewController
=
fromViewController
??
fromVC
fromViewController
=
fromViewController
??
fromVC
toViewController
=
toViewController
??
toVC
toViewController
=
toViewController
??
toVC
isNavigationController
=
true
isNavigationController
=
true
return
self
return
self
}
}
...
@@ -765,7 +780,11 @@ extension Motion: UINavigationControllerDelegate {
...
@@ -765,7 +780,11 @@ extension Motion: UINavigationControllerDelegate {
extension
Motion
:
UITabBarControllerDelegate
{
extension
Motion
:
UITabBarControllerDelegate
{
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
shouldSelect
viewController
:
UIViewController
)
->
Bool
{
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
shouldSelect
viewController
:
UIViewController
)
->
Bool
{
return
!
isAnimating
if
isTransitioning
{
cancel
(
isAnimated
:
false
)
}
return
true
}
}
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
interactionControllerFor
animationController
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
interactionControllerFor
animationController
:
UIViewControllerAnimatedTransitioning
)
->
UIViewControllerInteractiveTransitioning
?
{
...
@@ -773,7 +792,11 @@ extension Motion: UITabBarControllerDelegate {
...
@@ -773,7 +792,11 @@ extension Motion: UITabBarControllerDelegate {
}
}
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
public
func
tabBarController
(
_
tabBarController
:
UITabBarController
,
animationControllerForTransitionFrom
fromVC
:
UIViewController
,
to
toVC
:
UIViewController
)
->
UIViewControllerAnimatedTransitioning
?
{
isAnimating
=
true
guard
!
isTransitioning
else
{
return
nil
}
state
=
.
notified
let
fromVCIndex
=
tabBarController
.
childViewControllers
.
index
(
of
:
fromVC
)
!
let
fromVCIndex
=
tabBarController
.
childViewControllers
.
index
(
of
:
fromVC
)
!
let
toVCIndex
=
tabBarController
.
childViewControllers
.
index
(
of
:
toVC
)
!
let
toVCIndex
=
tabBarController
.
childViewControllers
.
index
(
of
:
toVC
)
!
...
...
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