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
21f6756b
Unverified
Commit
21f6756b
authored
Nov 11, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editor: progression commit on Pulse refactor
parent
062c21f8
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
67 additions
and
64 deletions
+67
-64
Material.xcodeproj/project.pbxproj
+6
-6
Sources/iOS/Button.swift
+9
-9
Sources/iOS/CollectionReusableView.swift
+7
-7
Sources/iOS/CollectionViewCell.swift
+7
-7
Sources/iOS/Layer.swift
+1
-1
Sources/iOS/Motion.swift
+7
-7
Sources/iOS/MotionPulse.swift
+11
-10
Sources/iOS/Pulse.swift
+4
-2
Sources/iOS/PulseView.swift
+6
-6
Sources/iOS/SnackbarController.swift
+1
-1
Sources/iOS/TableViewCell.swift
+7
-7
Sources/iOS/View.swift
+1
-1
No files found.
Material.xcodeproj/project.pbxproj
View file @
21f6756b
...
...
@@ -38,7 +38,7 @@
965E80E21DD4C50600D61E4B
/* View.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78C1CB40DC500C806FE
/* View.swift */
;
};
965E80E31DD4C53300D61E4B
/* Pulse.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9631A7C61D95E5D900CFB109
/* Pulse.swift */
;
};
965E80E41DD4C53300D61E4B
/* PulseView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7841CB40DC500C806FE
/* PulseView.swift */
;
};
965E80E51DD4C53300D61E4B
/*
PulseAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* PulseAnimation
.swift */
;
};
965E80E51DD4C53300D61E4B
/*
MotionPulse.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* MotionPulse
.swift */
;
};
965E80E61DD4C55200D61E4B
/* Material+Obj-C.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7631CB40DC500C806FE
/* Material+Obj-C.swift */
;
};
965E80E71DD4C55200D61E4B
/* Material+UIView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96E3C3931D397AE90086A024
/* Material+UIView.swift */
;
};
965E80E81DD4C55200D61E4B
/* Material+CALayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96F1DC871D654FDF0025F925
/* Material+CALayer.swift */
;
};
...
...
@@ -121,7 +121,7 @@
96BCB8101CB4115200C806FE
/* MotionTransition.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78B1CB40DC500C806FE
/* MotionTransition.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8111CB4115200C806FE
/* Motion.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB76D1CB40DC500C806FE
/* Motion.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8131CB4115200C806FE
/* MotionKeyframe.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB77E1CB40DC500C806FE
/* MotionKeyframe.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8141CB4115200C806FE
/*
PulseAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* PulseAnimation
.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8141CB4115200C806FE
/*
MotionPulse.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7821CB40DC500C806FE
/* MotionPulse
.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75F1CB40DC500C806FE
/* FabButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7601CB40DC500C806FE
/* FlatButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7701CB40DC500C806FE
/* Button.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -258,7 +258,7 @@
96BCB77E1CB40DC500C806FE
/* MotionKeyframe.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionKeyframe.swift
;
sourceTree
=
"<group>"
;
};
96BCB7801CB40DC500C806FE
/* Layer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layer.swift
;
sourceTree
=
"<group>"
;
};
96BCB7811CB40DC500C806FE
/* Layout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Layout.swift
;
sourceTree
=
"<group>"
;
};
96BCB7821CB40DC500C806FE
/*
PulseAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PulseAnimation
.swift
;
sourceTree
=
"<group>"
;
};
96BCB7821CB40DC500C806FE
/*
MotionPulse.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MotionPulse
.swift
;
sourceTree
=
"<group>"
;
};
96BCB7841CB40DC500C806FE
/* PulseView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PulseView.swift
;
sourceTree
=
"<group>"
;
};
96BCB7851CB40DC500C806FE
/* CornerRadius.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CornerRadius.swift
;
sourceTree
=
"<group>"
;
};
96BCB7861CB40DC500C806FE
/* Shape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Shape.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -414,7 +414,6 @@
children
=
(
9631A7C61D95E5D900CFB109
/* Pulse.swift */
,
96BCB7841CB40DC500C806FE
/* PulseView.swift */
,
96BCB7821CB40DC500C806FE
/* PulseAnimation.swift */
,
);
name
=
Pulse
;
sourceTree
=
"<group>"
;
...
...
@@ -717,6 +716,7 @@
96BCB78B1CB40DC500C806FE
/* MotionTransition.swift */
,
96BCB77E1CB40DC500C806FE
/* MotionKeyframe.swift */
,
96E3C39D1D3A1D0C0086A024
/* MotionBasic.swift */
,
96BCB7821CB40DC500C806FE
/* MotionPulse.swift */
,
);
name
=
Motion
;
sourceTree
=
"<group>"
;
...
...
@@ -795,7 +795,7 @@
96BCB8101CB4115200C806FE
/* MotionTransition.swift in Headers */
,
96BCB8111CB4115200C806FE
/* Motion.swift in Headers */
,
96BCB8131CB4115200C806FE
/* MotionKeyframe.swift in Headers */
,
96BCB8141CB4115200C806FE
/*
PulseAnimation
.swift in Headers */
,
96BCB8141CB4115200C806FE
/*
MotionPulse
.swift in Headers */
,
96BCB8151CB4115200C806FE
/* FabButton.swift in Headers */
,
96BCB8161CB4115200C806FE
/* FlatButton.swift in Headers */
,
96BCB8171CB4115200C806FE
/* Button.swift in Headers */
,
...
...
@@ -1099,7 +1099,7 @@
965E80ED1DD4C55200D61E4B
/* Material+UIWindow.swift in Sources */
,
965E80E31DD4C53300D61E4B
/* Pulse.swift in Sources */
,
965E80E41DD4C53300D61E4B
/* PulseView.swift in Sources */
,
965E80E51DD4C53300D61E4B
/*
PulseAnimation
.swift in Sources */
,
965E80E51DD4C53300D61E4B
/*
MotionPulse
.swift in Sources */
,
965E80FE1DD4D59500D61E4B
/* ToolbarController.swift in Sources */
,
965E80C81DD4C50600D61E4B
/* Motion.swift in Sources */
,
965E80C91DD4C50600D61E4B
/* MotionTransition.swift in Sources */
,
...
...
Sources/iOS/Button.swift
View file @
21f6756b
...
...
@@ -31,17 +31,17 @@
import
UIKit
open
class
Button
:
UIButton
,
Pulsable
{
/**
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
internal
internal(set)
lazy
var
pulse
:
P
ulse
=
Pulse
()
internal
var
p
ulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
...
...
@@ -183,12 +183,12 @@ open class Button: UIButton, Pulsable {
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
var
s
=
self
MotionPulse
Animation
<
Button
>.
pulseExpandAnimation
(
&
s
,
point
:
p
)
MotionPulse
<
Button
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
p
)
Motion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
var
s
=
self
else
{
return
}
MotionPulse
Animation
<
Button
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
Button
>.
contractAnimation
(
view
:
&
s
)
}
}
...
...
@@ -201,7 +201,7 @@ open class Button: UIButton, Pulsable {
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
Button
>.
pulseExpandAnimation
(
&
s
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
s
),
from
:
layer
))
MotionPulse
<
Button
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
))
}
/**
...
...
@@ -213,7 +213,7 @@ open class Button: UIButton, Pulsable {
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
Button
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
Button
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
@@ -225,7 +225,7 @@ open class Button: UIButton, Pulsable {
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
Button
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
Button
>.
contractAnimation
(
view
:
&
s
)
}
open
func
bringImageViewToFront
()
{
...
...
Sources/iOS/CollectionReusableView.swift
View file @
21f6756b
...
...
@@ -38,10 +38,10 @@ open class CollectionReusableView: UICollectionReusableView, Pulsable {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
internal
internal(set)
lazy
var
pulse
:
P
ulse
=
Pulse
()
internal
var
p
ulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
...
...
@@ -237,12 +237,12 @@ open class CollectionReusableView: UICollectionReusableView, Pulsable {
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
var
s
=
self
MotionPulse
Animation
<
CollectionReusableView
>.
pulseExpandAnimation
(
&
s
,
point
:
p
)
MotionPulse
<
CollectionReusableView
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
p
)
Motion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
var
s
=
self
else
{
return
}
MotionPulse
Animation
<
CollectionReusableView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionReusableView
>.
contractAnimation
(
view
:
&
s
)
}
}
...
...
@@ -255,7 +255,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulsable {
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionReusableView
>.
pulseExpandAnimation
(
&
s
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
s
),
from
:
layer
))
MotionPulse
<
CollectionReusableView
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
))
}
/**
...
...
@@ -267,7 +267,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulsable {
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionReusableView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionReusableView
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
@@ -279,7 +279,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulsable {
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionReusableView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionReusableView
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
Sources/iOS/CollectionViewCell.swift
View file @
21f6756b
...
...
@@ -38,10 +38,10 @@ open class CollectionViewCell: UICollectionViewCell, Pulsable {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
internal
internal(set)
lazy
var
pulse
:
P
ulse
=
Pulse
()
internal
var
p
ulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
...
...
@@ -244,12 +244,12 @@ open class CollectionViewCell: UICollectionViewCell, Pulsable {
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
var
s
=
self
MotionPulse
Animation
<
CollectionViewCell
>.
pulseExpandAnimation
(
&
s
,
point
:
p
)
MotionPulse
<
CollectionViewCell
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
p
)
Motion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
var
s
=
self
else
{
return
}
MotionPulse
Animation
<
CollectionViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionViewCell
>.
contractAnimation
(
view
:
&
s
)
}
}
...
...
@@ -262,7 +262,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulsable {
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionViewCell
>.
pulseExpandAnimation
(
&
s
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
s
),
from
:
layer
))
MotionPulse
<
CollectionViewCell
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
))
}
/**
...
...
@@ -274,7 +274,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulsable {
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionViewCell
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
@@ -286,7 +286,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulsable {
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
CollectionViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
CollectionViewCell
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
Sources/iOS/Layer.swift
View file @
21f6756b
...
...
@@ -38,7 +38,7 @@ open class Layer: CAShapeLayer {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/**
A property that manages an image for the visualLayer's contents
...
...
Sources/iOS/Motion.swift
View file @
21f6756b
...
...
@@ -84,7 +84,7 @@ public func AnimationTimingFunctionToValue(function: AnimationTimingFunction) ->
}
}
public
typealias
Anima
tionDelayCancelBlock
=
(
Bool
)
->
Void
public
typealias
Mo
tionDelayCancelBlock
=
(
Bool
)
->
Void
public
struct
Motion
{
/**
...
...
@@ -95,15 +95,15 @@ public struct Motion {
the animations have completed.
*/
@discardableResult
public
static
func
delay
(
time
:
TimeInterval
,
execute
block
:
@escaping
()
->
Void
)
->
Anima
tionDelayCancelBlock
?
{
public
static
func
delay
(
time
:
TimeInterval
,
execute
block
:
@escaping
()
->
Void
)
->
Mo
tionDelayCancelBlock
?
{
func
asyncAfter
(
completion
:
@escaping
()
->
Void
)
{
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
DispatchTime
.
now
()
+
time
,
execute
:
completion
)
}
var
cancelable
:
Anima
tionDelayCancelBlock
?
var
cancelable
:
Mo
tionDelayCancelBlock
?
let
delayed
:
Anima
tionDelayCancelBlock
=
{
let
delayed
:
Mo
tionDelayCancelBlock
=
{
if
!
$0
{
DispatchQueue
.
main
.
async
(
execute
:
block
)
}
...
...
@@ -121,10 +121,10 @@ public struct Motion {
}
/**
Cancels the delayed
Anima
tionDelayCancelBlock.
- Parameter delayed completion: An
Anima
tionDelayCancelBlock.
Cancels the delayed
Mo
tionDelayCancelBlock.
- Parameter delayed completion: An
Mo
tionDelayCancelBlock.
*/
public
static
func
cancel
(
delayed
completion
:
Anima
tionDelayCancelBlock
)
{
public
static
func
cancel
(
delayed
completion
:
Mo
tionDelayCancelBlock
)
{
completion
(
true
)
}
...
...
Sources/iOS/
PulseAnimation
.swift
→
Sources/iOS/
MotionPulse
.swift
View file @
21f6756b
...
...
@@ -42,14 +42,14 @@ public enum PulseAnimation: Int {
case
pointWithBacking
}
internal
struct
MotionPulse
Animation
<
T
:
UIView
>
where
T
:
Pulsable
{
internal
struct
MotionPulse
<
T
:
UIView
>
where
T
:
Pulsable
{
/**
Triggers the expanding animation.
- Parameter _ view: A Reference to the view to add the
animations too.
- Parameter point: A point to pulse from.
*/
internal
static
func
pulseExpandAnimation
(
_
view
:
inout
T
,
point
:
CGPoint
)
{
internal
static
func
expandAnimation
(
view
:
inout
T
,
visualLayer
:
CAShapeLayer
,
point
:
CGPoint
)
{
guard
.
none
!=
view
.
pulse
.
animation
else
{
return
}
...
...
@@ -63,15 +63,15 @@ internal struct MotionPulseAnimation<T: UIView> where T: Pulsable {
let
pLayer
=
CAShapeLayer
()
bLayer
.
addSublayer
(
pLayer
)
view
.
pulse
.
layers
.
insert
(
bLayer
,
at
:
0
)
vi
ew
.
vi
sualLayer
.
addSublayer
(
bLayer
)
view
.
pulse
.
layers
.
append
(
bLayer
)
visualLayer
.
addSublayer
(
bLayer
)
bLayer
.
zPosition
=
0
pLayer
.
zPosition
=
0
vi
ew
.
vi
sualLayer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
view
.
pulse
.
animation
||
.
radialBeyondBounds
==
view
.
pulse
.
animation
)
visualLayer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
view
.
pulse
.
animation
||
.
radialBeyondBounds
==
view
.
pulse
.
animation
)
Motion
.
disable
(
animations
:
{
[
view
=
view
]
in
bLayer
.
frame
=
vi
ew
.
vi
sualLayer
.
bounds
Motion
.
disable
(
animations
:
{
bLayer
.
frame
=
visualLayer
.
bounds
pLayer
.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
n
,
height
:
n
)
switch
view
.
pulse
.
animation
{
...
...
@@ -113,8 +113,9 @@ internal struct MotionPulseAnimation<T: UIView> where T: Pulsable {
animations too.
- Parameter pulse: A Pulse instance.
*/
internal
static
func
pulseContractAnimation
(
_
view
:
inout
T
)
{
guard
let
bLayer
=
view
.
pulse
.
layers
.
popLast
()
else
{
internal
static
func
contractAnimation
(
view
:
inout
T
)
{
var
view
=
view
guard
let
bLayer
=
view
.
pulse
.
layers
.
last
else
{
return
}
...
...
@@ -122,7 +123,7 @@ internal struct MotionPulseAnimation<T: UIView> where T: Pulsable {
return
}
Motion
.
delay
(
time
:
animated
?
0
:
0.15
)
{
[
view
=
view
]
in
Motion
.
delay
(
time
:
animated
?
0
:
0.15
)
{
guard
let
pLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
else
{
return
}
...
...
Sources/iOS/Pulse.swift
View file @
21f6756b
...
...
@@ -32,12 +32,14 @@ import UIKit
internal
protocol
Pulsable
{
var
pulse
:
Pulse
{
get
set
}
var
visualLayer
:
CAShapeLayer
{
get
set
}
var
pulseAnimation
:
PulseAnimation
{
get
set
}
var
pulseColor
:
UIColor
{
get
set
}
var
pulseOpacity
:
CGFloat
{
get
set
}
}
internal
struct
Pulse
{
/// An Array of layers.
internal
lazy
var
layers
=
[
CAShapeLayer
]()
internal
var
layers
=
[
CAShapeLayer
]()
/// A UIColor.
internal
var
color
=
Color
.
grey
.
base
...
...
Sources/iOS/PulseView.swift
View file @
21f6756b
...
...
@@ -32,7 +32,7 @@ import UIKit
open
class
PulseView
:
View
,
Pulsable
{
/// A Pulse reference.
internal
internal(set)
lazy
var
pulse
:
P
ulse
=
Pulse
()
internal
var
p
ulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
...
...
@@ -75,12 +75,12 @@ open class PulseView: View, Pulsable {
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
var
s
=
self
MotionPulse
Animation
<
PulseView
>.
pulseExpandAnimation
(
&
s
,
point
:
p
)
MotionPulse
<
PulseView
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
p
)
Motion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
var
s
=
self
else
{
return
}
MotionPulse
Animation
<
PulseView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
PulseView
>.
contractAnimation
(
view
:
&
s
)
}
}
...
...
@@ -93,7 +93,7 @@ open class PulseView: View, Pulsable {
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
PulseView
>.
pulseExpandAnimation
(
&
s
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
s
),
from
:
layer
))
MotionPulse
<
PulseView
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
))
}
/**
...
...
@@ -105,7 +105,7 @@ open class PulseView: View, Pulsable {
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
PulseView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
PulseView
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
@@ -117,6 +117,6 @@ open class PulseView: View, Pulsable {
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
PulseView
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
PulseView
>.
contractAnimation
(
view
:
&
s
)
}
}
Sources/iOS/SnackbarController.swift
View file @
21f6756b
...
...
@@ -107,7 +107,7 @@ open class SnackbarController: RootController {
- Parameter status: A SnackbarStatus enum value.
*/
@discardableResult
open
func
animate
(
snackbar
status
:
SnackbarStatus
,
delay
:
TimeInterval
=
0
,
animations
:
((
Snackbar
)
->
Void
)?
=
nil
,
completion
:
((
Snackbar
)
->
Void
)?
=
nil
)
->
Anima
tionDelayCancelBlock
?
{
open
func
animate
(
snackbar
status
:
SnackbarStatus
,
delay
:
TimeInterval
=
0
,
animations
:
((
Snackbar
)
->
Void
)?
=
nil
,
completion
:
((
Snackbar
)
->
Void
)?
=
nil
)
->
Mo
tionDelayCancelBlock
?
{
return
Motion
.
delay
(
time
:
delay
)
{
[
weak
self
,
status
=
status
,
animations
=
animations
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
...
...
Sources/iOS/TableViewCell.swift
View file @
21f6756b
...
...
@@ -37,10 +37,10 @@ open class TableViewCell: UITableViewCell, Pulsable {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
internal
internal(set)
lazy
var
pulse
:
P
ulse
=
Pulse
()
internal
var
p
ulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
...
...
@@ -121,12 +121,12 @@ open class TableViewCell: UITableViewCell, Pulsable {
let
p
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
var
s
=
self
MotionPulse
Animation
<
TableViewCell
>.
pulseExpandAnimation
(
&
s
,
point
:
p
)
MotionPulse
<
TableViewCell
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
p
)
Motion
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
guard
var
s
=
self
else
{
return
}
MotionPulse
Animation
<
TableViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
TableViewCell
>.
contractAnimation
(
view
:
&
s
)
}
}
...
...
@@ -139,7 +139,7 @@ open class TableViewCell: UITableViewCell, Pulsable {
open
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
TableViewCell
>.
pulseExpandAnimation
(
&
s
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
s
),
from
:
layer
))
MotionPulse
<
TableViewCell
>.
expandAnimation
(
view
:
&
s
,
visualLayer
:
visualLayer
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
))
}
/**
...
...
@@ -151,7 +151,7 @@ open class TableViewCell: UITableViewCell, Pulsable {
open
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
TableViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
TableViewCell
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
@@ -163,7 +163,7 @@ open class TableViewCell: UITableViewCell, Pulsable {
open
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
var
s
=
self
MotionPulse
Animation
<
TableViewCell
>.
pulseContractAnimation
(
&
s
)
MotionPulse
<
TableViewCell
>.
contractAnimation
(
view
:
&
s
)
}
/**
...
...
Sources/iOS/View.swift
View file @
21f6756b
...
...
@@ -37,7 +37,7 @@ open class View: UIView {
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
internal(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
internal(set)
var
visualLayer
=
CAShapeLayer
()
/**
A property that manages an image for the visualLayer's contents
...
...
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