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
adc55d38
Unverified
Commit
adc55d38
authored
Jun 10, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reworked the MotionViewControllerDelegate
parent
40cbb847
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
83 deletions
+125
-83
Motion.xcodeproj/project.pbxproj
+2
-6
Sources/Motion.swift
+123
-18
Sources/MotionViewController.swift
+0
-59
No files found.
Motion.xcodeproj/project.pbxproj
View file @
adc55d38
...
...
@@ -39,7 +39,6 @@
96AEB6A31EE4610F009A3BE0
/* MotionPlugin.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB67D1EE4610F009A3BE0
/* MotionPlugin.swift */
;
};
96AEB6A41EE4610F009A3BE0
/* MotionStringConvertible.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB67E1EE4610F009A3BE0
/* MotionStringConvertible.swift */
;
};
96AEB6A51EE4610F009A3BE0
/* MotionTransitionState.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB67F1EE4610F009A3BE0
/* MotionTransitionState.swift */
;
};
96AEB6A61EE4610F009A3BE0
/* MotionViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB6801EE4610F009A3BE0
/* MotionViewController.swift */
;
};
96AEB6A71EE4610F009A3BE0
/* Lexer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB6821EE4610F009A3BE0
/* Lexer.swift */
;
};
96AEB6A81EE4610F009A3BE0
/* Nodes.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB6831EE4610F009A3BE0
/* Nodes.swift */
;
};
96AEB6A91EE4610F009A3BE0
/* Parser.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96AEB6841EE4610F009A3BE0
/* Parser.swift */
;
};
...
...
@@ -84,7 +83,6 @@
96AEB67D1EE4610F009A3BE0
/* MotionPlugin.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionPlugin.swift
;
sourceTree
=
"<group>"
;
};
96AEB67E1EE4610F009A3BE0
/* MotionStringConvertible.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionStringConvertible.swift
;
sourceTree
=
"<group>"
;
};
96AEB67F1EE4610F009A3BE0
/* MotionTransitionState.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionTransitionState.swift
;
sourceTree
=
"<group>"
;
};
96AEB6801EE4610F009A3BE0
/* MotionViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionViewController.swift
;
sourceTree
=
"<group>"
;
};
96AEB6821EE4610F009A3BE0
/* Lexer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Lexer.swift
;
sourceTree
=
"<group>"
;
};
96AEB6831EE4610F009A3BE0
/* Nodes.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Nodes.swift
;
sourceTree
=
"<group>"
;
};
96AEB6841EE4610F009A3BE0
/* Parser.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Parser.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -209,11 +207,10 @@
966A7F0A1EEC424000A2DAAC
/* MotionCoordinateSpace.swift */
,
96AEB67F1EE4610F009A3BE0
/* MotionTransitionState.swift */
,
96AEB67B1EE4610F009A3BE0
/* MotionTransition.swift */
,
96
AEB67C1EE4610F009A3BE0
/* MotionTransition+MotionStringConvertible
.swift */
,
96
E49A3F1EEA08F8006D5A93
/* MotionTransitionObserver
.swift */
,
96AEB67D1EE4610F009A3BE0
/* MotionPlugin.swift */
,
96AEB67E1EE4610F009A3BE0
/* MotionStringConvertible.swift */
,
96AEB6801EE4610F009A3BE0
/* MotionViewController.swift */
,
96E49A3F1EEA08F8006D5A93
/* MotionTransitionObserver.swift */
,
96AEB67C1EE4610F009A3BE0
/* MotionTransition+MotionStringConvertible.swift */
,
96AEB6811EE4610F009A3BE0
/* Parser */
,
96AEB6861EE4610F009A3BE0
/* Preprocessors */
,
);
...
...
@@ -315,7 +312,6 @@
96AEB6961EE4610F009A3BE0
/* Motion+CAMediaTimingFunction.swift in Sources */
,
96AEB6941EE4610F009A3BE0
/* Motion+Array.swift in Sources */
,
96AEB6951EE4610F009A3BE0
/* Motion+CALayer.swift in Sources */
,
96AEB6A61EE4610F009A3BE0
/* MotionViewController.swift in Sources */
,
96AEB68E1EE4610F009A3BE0
/* MotionCoreAnimationViewContext.swift in Sources */
,
96AEB6921EE4610F009A3BE0
/* MotionDebugView.swift in Sources */
,
96E49A401EEA08F8006D5A93
/* MotionTransitionObserver.swift in Sources */
,
...
...
Sources/Motion.swift
View file @
adc55d38
...
...
@@ -28,6 +28,87 @@
import
UIKit
@objc(MotionViewControllerDelegate)
public
protocol
MotionViewControllerDelegate
{
/**
An optional delegation method that is executed motion will start the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motionWillStartTransition
(
motion
:
Motion
)
/**
An optional delegation method that is executed motion did end the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motionDidEndTransition
(
motion
:
Motion
)
/**
An optional delegation method that is executed motion did cancel the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motionDidCancelTransition
(
motion
:
Motion
)
/**
An optional delegation method that is executed when the source
view controller will start the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
willStartTransitionFrom
viewController
:
UIViewController
)
/**
An optional delegation method that is executed when the source
view controller did end the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
didEndTransitionFrom
viewController
:
UIViewController
)
/**
An optional delegation method that is executed when the source
view controller did cancel the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
didCancelTransitionFrom
viewController
:
UIViewController
)
/**
An optional delegation method that is executed when the destination
view controller will start the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
willStartTransitionTo
viewController
:
UIViewController
)
/**
An optional delegation method that is executed when the destination
view controller did end the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
didEndTransitionTo
viewController
:
UIViewController
)
/**
An optional delegation method that is executed when the destination
view controller did cancel the transition.
- Parameter motion: A Motion instance.
- Parameter willStartTransitionFrom viewController: A UIViewController.
*/
@objc
optional
func
motion
(
motion
:
Motion
,
didCancelTransitionTo
viewController
:
UIViewController
)
}
/**
### The singleton class/object for controlling interactive transitions.
...
...
@@ -253,28 +334,44 @@ internal extension Motion {
if
finished
{
if
let
fvc
=
fvc
,
let
tvc
=
tvc
{
processForMotionDelegate
(
viewController
:
fvc
)
{
$0
.
motionDidEndAnimatingTo
?(
viewController
:
tvc
)
$0
.
motionDidEndTransition
?()
processForMotionDelegate
(
viewController
:
fvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
processForMotionDelegate
(
viewController
:
tvc
)
{
$0
.
motionDidEndAnimatingFrom
?(
viewController
:
fvc
)
$0
.
motionDidEndTransition
?()
$0
.
motion
?(
motion
:
s
,
didEndTransitionTo
:
tvc
)
$0
.
motionDidEndTransition
?(
motion
:
s
)
}
processForMotionDelegate
(
viewController
:
tvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
$0
.
motion
?(
motion
:
s
,
didEndTransitionFrom
:
fvc
)
$0
.
motionDidEndTransition
?(
motion
:
s
)
}
}
tContext
?
.
finishInteractiveTransition
()
}
else
{
if
let
fvc
=
fvc
,
let
tvc
=
tvc
{
processForMotionDelegate
(
viewController
:
fvc
)
{
$0
.
motionDidCancelAnimatingTo
?(
viewController
:
tvc
)
$0
.
motionDidCancelTransition
?()
processForMotionDelegate
(
viewController
:
fvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
processForMotionDelegate
(
viewController
:
tvc
)
{
$0
.
motionDidCancelAnimatingFrom
?(
viewController
:
fvc
)
$0
.
motionDidCancelTransition
?()
$0
.
motion
?(
motion
:
s
,
didCancelTransitionTo
:
tvc
)
$0
.
motionDidCancelTransition
?(
motion
:
s
)
}
processForMotionDelegate
(
viewController
:
tvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
$0
.
motion
?(
motion
:
s
,
didCancelTransitionFrom
:
fvc
)
$0
.
motionDidCancelTransition
?(
motion
:
s
)
}
}
...
...
@@ -292,14 +389,22 @@ fileprivate extension Motion {
return
}
processForMotionDelegate
(
viewController
:
fvc
)
{
$0
.
motionWillStartTransition
?()
$0
.
motionWillStartAnimatingTo
?(
viewController
:
tvc
)
processForMotionDelegate
(
viewController
:
fvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
$0
.
motionWillStartTransition
?(
motion
:
s
)
$0
.
motion
?(
motion
:
s
,
willStartTransitionTo
:
tvc
)
}
processForMotionDelegate
(
viewController
:
tvc
)
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
processForMotionDelegate
(
viewController
:
tvc
)
{
$0
.
motionWillStartTransition
?()
$0
.
motionWillStartAnimatingFrom
?(
viewController
:
fvc
)
$0
.
motionWillStartTransition
?(
motion
:
s
)
$0
.
motion
?(
motion
:
s
,
willStartTransitionFrom
:
fvc
)
}
}
...
...
Sources/MotionViewController.swift
deleted
100644 → 0
View file @
40cbb847
/*
* The MIT License (MIT)
*
* Copyright (C) 2017, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.com>.
* All rights reserved.
*
* Original Inspiration & Author
* Copyright (c) 2016 Luke Zhao <me@lkzhao.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import
UIKit
@objc(MotionViewControllerDelegate)
public
protocol
MotionViewControllerDelegate
{
@objc
optional
func
motionWillStartAnimatingFrom
(
viewController
:
UIViewController
)
@objc
optional
func
motionDidEndAnimatingFrom
(
viewController
:
UIViewController
)
@objc
optional
func
motionDidCancelAnimatingFrom
(
viewController
:
UIViewController
)
@objc
optional
func
motionWillStartTransition
()
@objc
optional
func
motionDidEndTransition
()
@objc
optional
func
motionDidCancelTransition
()
@objc
optional
func
motionWillStartAnimatingTo
(
viewController
:
UIViewController
)
@objc
optional
func
motionDidEndAnimatingTo
(
viewController
:
UIViewController
)
@objc
optional
func
motionDidCancelAnimatingTo
(
viewController
:
UIViewController
)
}
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