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
392f0689
Unverified
Commit
392f0689
authored
Feb 02, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: fixed issue when detecting motion transitions
parent
df2f0742
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
22 deletions
+21
-22
Material.xcodeproj/project.pbxproj
+8
-8
Sources/iOS/Motion.swift
+1
-1
Sources/iOS/MotionTransition.swift
+12
-13
No files found.
Material.xcodeproj/project.pbxproj
View file @
392f0689
...
@@ -1408,7 +1408,7 @@
...
@@ -1408,7 +1408,7 @@
INFOPLIST_FILE
=
Sources/Info.plist
;
INFOPLIST_FILE
=
Sources/Info.plist
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.cosmicmind.Material
;
PRODUCT_BUNDLE_IDENTIFIER
=
com
.cosmicmind.Material
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
PROVISIONING_PROFILE
=
""
;
PROVISIONING_PROFILE
=
""
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
...
@@ -1433,7 +1433,7 @@
...
@@ -1433,7 +1433,7 @@
INFOPLIST_FILE
=
Sources/Info.plist
;
INFOPLIST_FILE
=
Sources/Info.plist
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.cosmicmind.Material
;
PRODUCT_BUNDLE_IDENTIFIER
=
com
.cosmicmind.Material
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
PROVISIONING_PROFILE
=
""
;
PROVISIONING_PROFILE
=
""
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
...
@@ -1457,7 +1457,7 @@
...
@@ -1457,7 +1457,7 @@
);
);
INFOPLIST_FILE
=
Tests/Info.plist
;
INFOPLIST_FILE
=
Tests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
io
.cosmicmind.Material-iOS-Tests"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
com
.cosmicmind.Material-iOS-Tests"
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_VERSION
=
3.0
;
SWIFT_VERSION
=
3.0
;
...
@@ -1475,7 +1475,7 @@
...
@@ -1475,7 +1475,7 @@
);
);
INFOPLIST_FILE
=
Tests/Info.plist
;
INFOPLIST_FILE
=
Tests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
io
.cosmicmind.Material-iOS-Tests"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
com
.cosmicmind.Material-iOS-Tests"
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_VERSION
=
3.0
;
SWIFT_VERSION
=
3.0
;
...
@@ -1498,7 +1498,7 @@
...
@@ -1498,7 +1498,7 @@
INFOPLIST_FILE
=
Sources/Info.plist
;
INFOPLIST_FILE
=
Sources/Info.plist
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.cosmicmind.Material
;
PRODUCT_BUNDLE_IDENTIFIER
=
com
.cosmicmind.Material
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
...
@@ -1522,7 +1522,7 @@
...
@@ -1522,7 +1522,7 @@
INFOPLIST_FILE
=
Sources/Info.plist
;
INFOPLIST_FILE
=
Sources/Info.plist
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
INSTALL_PATH
=
"$(LOCAL_LIBRARY_DIR)/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
io
.cosmicmind.Material
;
PRODUCT_BUNDLE_IDENTIFIER
=
com
.cosmicmind.Material
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
...
@@ -1542,7 +1542,7 @@
...
@@ -1542,7 +1542,7 @@
INFOPLIST_FILE
=
Tests/Info.plist
;
INFOPLIST_FILE
=
Tests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
MACOSX_DEPLOYMENT_TARGET
=
10.11
;
MACOSX_DEPLOYMENT_TARGET
=
10.11
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
io
.cosmicmind.Material-OSX-Tests"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
com
.cosmicmind.Material-OSX-Tests"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SWIFT_VERSION
=
3.0
;
SWIFT_VERSION
=
3.0
;
...
@@ -1559,7 +1559,7 @@
...
@@ -1559,7 +1559,7 @@
INFOPLIST_FILE
=
Tests/Info.plist
;
INFOPLIST_FILE
=
Tests/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"
;
MACOSX_DEPLOYMENT_TARGET
=
10.11
;
MACOSX_DEPLOYMENT_TARGET
=
10.11
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
io
.cosmicmind.Material-OSX-Tests"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"
com
.cosmicmind.Material-OSX-Tests"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SWIFT_VERSION
=
3.0
;
SWIFT_VERSION
=
3.0
;
...
...
Sources/iOS/Motion.swift
View file @
392f0689
...
@@ -117,7 +117,7 @@ public struct Motion {
...
@@ -117,7 +117,7 @@ public struct Motion {
cancelable
?(
false
)
cancelable
?(
false
)
}
}
return
cancelable
;
return
cancelable
}
}
/**
/**
...
...
Sources/iOS/MotionTransition.swift
View file @
392f0689
...
@@ -235,7 +235,7 @@ open class MotionTransition: NSObject {
...
@@ -235,7 +235,7 @@ open class MotionTransition: NSObject {
open
var
transitionContext
:
UIViewControllerContextTransitioning
!
open
var
transitionContext
:
UIViewControllerContextTransitioning
!
open
var
delay
:
TimeInterval
=
0
open
var
delay
:
TimeInterval
=
0
open
var
duration
:
TimeInterval
=
0
open
var
duration
:
TimeInterval
=
0
.35
open
var
containerView
:
UIView
!
open
var
containerView
:
UIView
!
open
var
transitionView
=
UIView
()
open
var
transitionView
=
UIView
()
...
@@ -331,11 +331,11 @@ extension MotionTransition {
...
@@ -331,11 +331,11 @@ extension MotionTransition {
fileprivate
func
prepareTransitionPairs
()
{
fileprivate
func
prepareTransitionPairs
()
{
for
from
in
fromSubviews
{
for
from
in
fromSubviews
{
for
to
in
toSubviews
{
guard
0
<
from
.
motionTransitionIdentifier
.
utf16
.
count
else
{
guard
0
<
from
.
motionTransitionAnimations
.
count
else
{
continue
return
}
}
for
to
in
toSubviews
{
guard
to
.
motionTransitionIdentifier
==
from
.
motionTransitionIdentifier
else
{
guard
to
.
motionTransitionIdentifier
==
from
.
motionTransitionIdentifier
else
{
continue
continue
}
}
...
@@ -372,17 +372,14 @@ extension MotionTransition {
...
@@ -372,17 +372,14 @@ extension MotionTransition {
addBackgroundMotionAnimation
()
addBackgroundMotionAnimation
()
cleanupAnimation
()
cleanupAnimation
()
cleanup
FromView
()
hide
FromView
()
cleanup
TransitionSnapshot
()
remove
TransitionSnapshot
()
}
}
}
}
extension
MotionTransition
{
extension
MotionTransition
{
fileprivate
func
addTransitionAnimations
()
{
fileprivate
func
addTransitionAnimations
()
{
for
(
from
,
to
)
in
transitionPairs
{
for
(
from
,
to
)
in
transitionPairs
{
let
t
=
motionDelay
(
animations
:
to
.
motionTransitionAnimations
)
let
d
=
motionDuration
(
animations
:
to
.
motionTransitionAnimations
)
var
snapshotAnimations
=
[
CABasicAnimation
]()
var
snapshotAnimations
=
[
CABasicAnimation
]()
var
snapshotChildAnimations
=
[
CABasicAnimation
]()
var
snapshotChildAnimations
=
[
CABasicAnimation
]()
...
@@ -399,10 +396,12 @@ extension MotionTransition {
...
@@ -399,10 +396,12 @@ extension MotionTransition {
snapshotChildAnimations
.
append
(
sizeAnimation
)
snapshotChildAnimations
.
append
(
sizeAnimation
)
snapshotChildAnimations
.
append
(
Motion
.
position
(
x
:
to
.
bounds
.
width
/
2
,
y
:
to
.
bounds
.
height
/
2
))
snapshotChildAnimations
.
append
(
Motion
.
position
(
x
:
to
.
bounds
.
width
/
2
,
y
:
to
.
bounds
.
height
/
2
))
let
d
=
motionDuration
(
animations
:
to
.
motionTransitionAnimations
)
let
snapshot
=
from
.
motionTransitionSnapshot
(
afterUpdates
:
true
)
let
snapshot
=
from
.
motionTransitionSnapshot
(
afterUpdates
:
true
)
transitionView
.
addSubview
(
snapshot
)
transitionView
.
addSubview
(
snapshot
)
Motion
.
delay
(
t
)
{
[
weak
self
,
weak
to
]
in
Motion
.
delay
(
motionDelay
(
animations
:
to
.
motionTransitionAnimations
)
)
{
[
weak
self
,
weak
to
]
in
guard
let
s
=
self
else
{
guard
let
s
=
self
else
{
return
return
}
}
...
@@ -451,7 +450,7 @@ extension MotionTransition {
...
@@ -451,7 +450,7 @@ extension MotionTransition {
}
}
fileprivate
func
motionDuration
(
animations
:
[
MotionAnimation
])
->
TimeInterval
{
fileprivate
func
motionDuration
(
animations
:
[
MotionAnimation
])
->
TimeInterval
{
var
t
:
TimeInterval
=
0
var
t
:
TimeInterval
=
0
.35
for
a
in
animations
{
for
a
in
animations
{
switch
a
{
switch
a
{
case
let
.
duration
(
time
):
case
let
.
duration
(
time
):
...
@@ -492,13 +491,13 @@ extension MotionTransition {
...
@@ -492,13 +491,13 @@ extension MotionTransition {
}
}
}
}
fileprivate
func
cleanup
FromView
()
{
fileprivate
func
hide
FromView
()
{
Motion
.
delay
(
delay
)
{
[
weak
self
]
in
Motion
.
delay
(
delay
)
{
[
weak
self
]
in
self
?
.
fromView
.
isHidden
=
true
self
?
.
fromView
.
isHidden
=
true
}
}
}
}
fileprivate
func
cleanup
TransitionSnapshot
()
{
fileprivate
func
remove
TransitionSnapshot
()
{
Motion
.
delay
(
delay
)
{
[
weak
self
]
in
Motion
.
delay
(
delay
)
{
[
weak
self
]
in
self
?
.
transitionSnapshot
.
removeFromSuperview
()
self
?
.
transitionSnapshot
.
removeFromSuperview
()
}
}
...
...
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