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
d54c304b
Commit
d54c304b
authored
Dec 17, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated SourcePreprocessor with latest statement settings
parent
104aead0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
23 deletions
+28
-23
Sources/Preprocessors/CascadePreprocessor.swift
+9
-6
Sources/Preprocessors/IgnoreSubviewModifiersPreprocessor.swift
+7
-3
Sources/Preprocessors/SourcePreprocessor.swift
+7
-9
Sources/Preprocessors/TransitionPreprocessor.swift
+5
-5
No files found.
Sources/Preprocessors/CascadePreprocessor.swift
View file @
d54c304b
...
...
@@ -88,24 +88,27 @@ class CascadePreprocessor: MotionCorePreprocessor {
- Parameter views: An Array of UIViews.
*/
func
process
(
views
:
[
UIView
])
{
for
view
in
views
{
guard
let
(
deltaTime
,
direction
,
delayMatchedViews
)
=
context
[
view
]?
.
cascade
else
{
continue
}
for
v
in
views
{
guard
let
(
deltaTime
,
direction
,
delayMatchedViews
)
=
context
[
v
]?
.
cascade
else
{
continue
}
var
parentView
=
v
var
parentView
=
view
if
view
is
UITableView
,
let
wrapperView
=
view
.
subviews
.
get
(
0
)
{
if
v
is
UITableView
,
let
wrapperView
=
v
.
subviews
.
get
(
0
)
{
parentView
=
wrapperView
}
let
sortedSubviews
=
parentView
.
subviews
.
sorted
(
by
:
direction
.
comparator
)
let
initialDelay
=
context
[
v
iew
]
!.
delay
let
initialDelay
=
context
[
v
]
!.
delay
let
finalDelay
=
TimeInterval
(
sortedSubviews
.
count
)
*
deltaTime
+
initialDelay
for
(
i
,
subview
)
in
sortedSubviews
.
enumerated
()
{
let
delay
=
TimeInterval
(
i
)
*
deltaTime
+
initialDelay
func
applyDelay
(
view
:
UIView
)
{
if
context
.
pairedView
(
for
:
view
)
==
nil
{
if
nil
==
context
.
pairedView
(
for
:
view
)
{
context
[
view
]?
.
delay
=
delay
}
else
if
delayMatchedViews
,
let
paired
=
context
.
pairedView
(
for
:
view
)
{
...
...
Sources/Preprocessors/IgnoreSubviewModifiersPreprocessor.swift
View file @
d54c304b
...
...
@@ -35,8 +35,8 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
- Parameter toViews: An Array of UIViews.
*/
override
func
process
(
fromViews
:
[
UIView
],
toViews
:
[
UIView
])
{
process
(
views
:
fromViews
)
process
(
views
:
toViews
)
process
(
views
:
fromViews
)
process
(
views
:
toViews
)
}
/**
...
...
@@ -49,7 +49,11 @@ class IgnoreSubviewTransitionsPreprocessor: MotionCorePreprocessor {
continue
}
let
parentView
=
v
is
UITableView
?
v
.
subviews
.
get
(
0
)
??
v
:
v
var
parentView
=
v
if
v
is
UITableView
,
let
wrapperView
=
v
.
subviews
.
get
(
0
)
{
parentView
=
wrapperView
}
guard
recursive
else
{
for
subview
in
parentView
.
subviews
{
...
...
Sources/Preprocessors/SourcePreprocessor.swift
View file @
d54c304b
...
...
@@ -36,7 +36,7 @@ class SourcePreprocessor: MotionCorePreprocessor {
*/
override
func
process
(
fromViews
:
[
UIView
],
toViews
:
[
UIView
])
{
for
fv
in
fromViews
{
guard
let
i
=
context
[
fv
]?
.
motionIdentifier
,
let
tv
=
context
.
destinationView
(
for
:
i
)
else
{
guard
let
motionIdentifier
=
context
[
fv
]?
.
motionIdentifier
,
let
tv
=
context
.
destinationView
(
for
:
motionIdentifier
)
else
{
continue
}
...
...
@@ -61,6 +61,8 @@ fileprivate extension SourcePreprocessor {
*/
func
prepare
(
view
:
UIView
,
for
targetView
:
UIView
)
{
let
targetPos
=
context
.
container
.
convert
(
targetView
.
layer
.
position
,
from
:
targetView
.
superview
!
)
let
targetTransform
=
context
.
container
.
layer
.
flatTransformTo
(
layer
:
targetView
.
layer
)
var
state
=
context
[
view
]
!
/**
...
...
@@ -68,13 +70,13 @@ fileprivate extension SourcePreprocessor {
converted from the global container
*/
state
.
coordinateSpace
=
.
global
state
.
position
=
targetPos
state
.
transform
=
targetTransform
// Remove incompatible options.
state
.
position
=
targetPos
state
.
transform
=
nil
state
.
size
=
nil
state
.
cornerRadius
=
nil
if
view
.
bounds
.
size
!=
targetView
.
bounds
.
size
{
state
.
size
=
targetView
.
bounds
.
size
}
...
...
@@ -83,10 +85,6 @@ fileprivate extension SourcePreprocessor {
state
.
cornerRadius
=
targetView
.
layer
.
cornerRadius
}
if
view
.
layer
.
transform
!=
targetView
.
layer
.
transform
{
state
.
transform
=
targetView
.
layer
.
transform
}
if
view
.
layer
.
shadowColor
!=
targetView
.
layer
.
shadowColor
{
state
.
shadowColor
=
targetView
.
layer
.
shadowColor
}
...
...
Sources/Preprocessors/TransitionPreprocessor.swift
View file @
d54c304b
...
...
@@ -182,12 +182,12 @@ class TransitionPreprocessor: MotionCorePreprocessor {
guard
let
m
=
motion
else
{
return
}
guard
let
fv
=
m
.
from
View
else
{
guard
let
tv
=
m
.
to
View
else
{
return
}
guard
let
tv
=
m
.
to
View
else
{
guard
let
fv
=
m
.
from
View
else
{
return
}
...
...
@@ -224,10 +224,10 @@ class TransitionPreprocessor: MotionCorePreprocessor {
defaultAnimation
=
.
none
}
else
if
isNavigationController
{
defaultAnimation
=
isPresenting
?
.
push
(
direction
:
.
left
)
:
.
pull
(
direction
:
.
right
)
defaultAnimation
=
isPresenting
?
.
push
(
direction
:
.
left
)
:
.
pull
(
direction
:
.
right
)
}
else
if
isTabBarController
{
defaultAnimation
=
isPresenting
?
.
slide
(
direction
:
.
left
)
:
.
slide
(
direction
:
.
right
)
defaultAnimation
=
isPresenting
?
.
slide
(
direction
:
.
left
)
:
.
slide
(
direction
:
.
right
)
}
else
{
defaultAnimation
=
.
fade
...
...
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