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
777f4942
Unverified
Commit
777f4942
authored
Apr 06, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Pulse internal API
parent
a861a90b
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
93 additions
and
57 deletions
+93
-57
Sources/iOS/Bar.swift
+8
-4
Sources/iOS/Button.swift
+2
-2
Sources/iOS/Card.swift
+12
-6
Sources/iOS/CollectionReusableView.swift
+2
-2
Sources/iOS/CollectionViewCell.swift
+2
-2
Sources/iOS/ErrorTextField.swift
+2
-1
Sources/iOS/FABMenu.swift
+4
-2
Sources/iOS/ImageCard.swift
+8
-4
Sources/iOS/NavigationBar.swift
+6
-3
Sources/iOS/NavigationItem.swift
+8
-4
Sources/iOS/PresenterCard.swift
+4
-2
Sources/iOS/PulseAnimation.swift
+11
-11
Sources/iOS/PulseView.swift
+2
-2
Sources/iOS/Snackbar.swift
+2
-1
Sources/iOS/TabBar.swift
+4
-2
Sources/iOS/TableViewCell.swift
+2
-2
Sources/iOS/TextField.swift
+10
-5
Sources/iOS/Toolbar.swift
+4
-2
No files found.
Sources/iOS/Bar.swift
View file @
777f4942
...
...
@@ -49,7 +49,8 @@ open class Bar: View {
/// Should center the contentView.
open
var
contentViewAlignment
=
ContentViewAlignment
.
full
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -100,7 +101,8 @@ open class Bar: View {
open
var
gridFactor
:
CGFloat
=
12
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -113,7 +115,8 @@ open class Bar: View {
for
v
in
oldValue
{
v
.
removeFromSuperview
()
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -123,7 +126,8 @@ open class Bar: View {
for
v
in
oldValue
{
v
.
removeFromSuperview
()
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/Button.swift
View file @
777f4942
...
...
@@ -44,7 +44,7 @@ open class Button: UIButton, Pulseable, PulseableLayer {
/// A reference to the pulse layer.
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseL
ayer
return
pulse
.
l
ayer
}
/// PulseAnimation value.
...
...
@@ -263,7 +263,7 @@ extension Button {
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
pulse
=
Pulse
(
pulseView
:
self
,
pulseL
ayer
:
visualLayer
)
pulse
=
Pulse
(
view
:
self
,
l
ayer
:
visualLayer
)
}
/**
...
...
Sources/iOS/Card.swift
View file @
777f4942
...
...
@@ -69,7 +69,8 @@ open class Card: PulseView {
if
let
v
=
toolbar
{
container
.
addSubview
(
v
)
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -84,7 +85,8 @@ open class Card: PulseView {
@IBInspectable
open
var
toolbarEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -97,7 +99,8 @@ open class Card: PulseView {
v
.
clipsToBounds
=
true
container
.
addSubview
(
v
)
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -112,7 +115,8 @@ open class Card: PulseView {
@IBInspectable
open
var
contentViewEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -124,7 +128,8 @@ open class Card: PulseView {
if
let
v
=
bottomBar
{
container
.
addSubview
(
v
)
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -139,7 +144,8 @@ open class Card: PulseView {
@IBInspectable
open
var
bottomBarEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
777f4942
...
...
@@ -45,7 +45,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
/// A reference to the pulse layer.
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseL
ayer
return
pulse
.
l
ayer
}
/// PulseAnimation value.
...
...
@@ -301,7 +301,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable, Pulseabl
extension
CollectionReusableView
{
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
pulse
=
Pulse
(
pulseView
:
self
,
pulseL
ayer
:
visualLayer
)
pulse
=
Pulse
(
view
:
self
,
l
ayer
:
visualLayer
)
pulseAnimation
=
.
none
}
...
...
Sources/iOS/CollectionViewCell.swift
View file @
777f4942
...
...
@@ -45,7 +45,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
/// A reference to the pulse layer.
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseL
ayer
return
pulse
.
l
ayer
}
/// PulseAnimation value.
...
...
@@ -259,7 +259,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable, PulseableLayer {
extension
CollectionViewCell
{
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
pulse
=
Pulse
(
pulseView
:
self
,
pulseL
ayer
:
visualLayer
)
pulse
=
Pulse
(
view
:
self
,
l
ayer
:
visualLayer
)
}
/// Prepares the visualLayer property.
...
...
Sources/iOS/ErrorTextField.swift
View file @
777f4942
...
...
@@ -36,7 +36,8 @@ open class ErrorTextField: TextField {
open
var
isErrorRevealed
=
false
{
didSet
{
detailLabel
.
isHidden
=
!
isErrorRevealed
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/FABMenu.swift
View file @
777f4942
...
...
@@ -67,7 +67,8 @@ open class FABMenuItem: View {
}
set
(
value
)
{
titleLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -200,7 +201,8 @@ open class FABMenu: View {
spring
.
springDirection
=
.
right
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/ImageCard.swift
View file @
777f4942
...
...
@@ -44,7 +44,8 @@ open class ImageCard: Card {
*/
open
var
imageViewDisplay
=
Display
.
partial
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -59,7 +60,8 @@ open class ImageCard: Card {
@IBInspectable
open
var
imageViewEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -71,14 +73,16 @@ open class ImageCard: Card {
if
let
v
=
imageView
{
container
.
addSubview
(
v
)
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
/// An ImageCardToolbarAlignment value.
open
var
toolbarAlignment
=
ToolbarAlignment
.
bottom
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
777f4942
...
...
@@ -51,7 +51,8 @@ open class NavigationBar: UINavigationBar {
@IBInspectable
open
var
contentEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -66,7 +67,8 @@ open class NavigationBar: UINavigationBar {
@IBInspectable
open
var
interimSpace
:
InterimSpace
=
0
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -75,7 +77,8 @@ open class NavigationBar: UINavigationBar {
open
var
gridFactor
:
CGFloat
=
12
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/NavigationItem.swift
View file @
777f4942
...
...
@@ -38,7 +38,8 @@ public class NavigationItem: NSObject {
/// Should center the contentView.
open
var
contentViewAlignment
=
ContentViewAlignment
.
center
{
didSet
{
navigationBar
?
.
layoutSubviews
()
navigationBar
?
.
setNeedsLayout
()
navigationBar
?
.
layoutIfNeeded
()
}
}
...
...
@@ -60,7 +61,8 @@ public class NavigationItem: NSObject {
for
v
in
oldValue
{
v
.
removeFromSuperview
()
}
navigationBar
?
.
layoutSubviews
()
navigationBar
?
.
setNeedsLayout
()
navigationBar
?
.
layoutIfNeeded
()
}
}
...
...
@@ -70,7 +72,8 @@ public class NavigationItem: NSObject {
for
v
in
oldValue
{
v
.
removeFromSuperview
()
}
navigationBar
?
.
layoutSubviews
()
navigationBar
?
.
setNeedsLayout
()
navigationBar
?
.
layoutIfNeeded
()
}
}
...
...
@@ -109,7 +112,8 @@ public class NavigationItem: NSObject {
/// Reloads the subviews for the NavigationBar.
internal
func
reload
()
{
navigationBar
?
.
layoutSubviews
()
navigationBar
?
.
setNeedsLayout
()
navigationBar
?
.
layoutIfNeeded
()
}
/// Prepares the titleLabel.
...
...
Sources/iOS/PresenterCard.swift
View file @
777f4942
...
...
@@ -42,7 +42,8 @@ open class PresenterCard: Card {
@IBInspectable
open
var
presenterViewEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -55,7 +56,8 @@ open class PresenterCard: Card {
v
.
clipsToBounds
=
true
container
.
addSubview
(
v
)
}
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/PulseAnimation.swift
View file @
777f4942
...
...
@@ -60,10 +60,10 @@ internal protocol PulseableLayer {
public
struct
Pulse
{
/// A UIView that is Pulseable.
fileprivate
weak
var
pulseV
iew
:
UIView
?
fileprivate
weak
var
v
iew
:
UIView
?
/// The layer the pulse layers are added to.
internal
weak
var
pulseL
ayer
:
CALayer
?
internal
weak
var
l
ayer
:
CALayer
?
/// Pulse layers.
fileprivate
var
layers
=
[
CAShapeLayer
]()
...
...
@@ -79,12 +79,12 @@ public struct Pulse {
/**
An initializer that takes a given view and pulse layer.
- Parameter
pulseV
iew: An optional UIView.
- Parameter
pulseL
ayer: An optional CALayer.
- Parameter
v
iew: An optional UIView.
- Parameter
l
ayer: An optional CALayer.
*/
internal
init
(
pulseView
:
UIView
?,
pulseL
ayer
:
CALayer
?)
{
self
.
pulseView
=
pulseV
iew
self
.
pulseLayer
=
pulseL
ayer
internal
init
(
view
:
UIView
?,
l
ayer
:
CALayer
?)
{
self
.
view
=
v
iew
self
.
layer
=
l
ayer
}
/**
...
...
@@ -92,11 +92,11 @@ public struct Pulse {
- Parameter point: A point to pulse from.
*/
public
mutating
func
expand
(
point
:
CGPoint
)
{
guard
let
v
iew
=
pulseV
iew
else
{
guard
let
v
=
v
iew
else
{
return
}
guard
let
layer
=
pulseL
ayer
else
{
guard
let
layer
=
l
ayer
else
{
return
}
...
...
@@ -116,8 +116,8 @@ public struct Pulse {
layer
.
masksToBounds
=
!
(
.
centerRadialBeyondBounds
==
animation
||
.
radialBeyondBounds
==
animation
)
let
w
=
v
iew
.
bounds
.
width
let
h
=
v
iew
.
bounds
.
height
let
w
=
v
.
bounds
.
width
let
h
=
v
.
bounds
.
height
Motion
.
disable
({
[
n
=
.
center
==
animation
?
w
<
h
?
w
:
h
:
w
<
h
?
h
:
w
,
...
...
Sources/iOS/PulseView.swift
View file @
777f4942
...
...
@@ -36,7 +36,7 @@ open class PulseView: View, Pulseable, PulseableLayer {
/// A reference to the pulse layer.
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseL
ayer
return
pulse
.
l
ayer
}
/// PulseAnimation value.
...
...
@@ -132,6 +132,6 @@ open class PulseView: View, Pulseable, PulseableLayer {
extension
PulseView
{
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
pulse
=
Pulse
(
pulseView
:
self
,
pulseL
ayer
:
visualLayer
)
pulse
=
Pulse
(
view
:
self
,
l
ayer
:
visualLayer
)
}
}
Sources/iOS/Snackbar.swift
View file @
777f4942
...
...
@@ -44,7 +44,8 @@ open class Snackbar: Bar {
}
set
(
value
)
{
textLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/TabBar.swift
View file @
777f4942
...
...
@@ -118,7 +118,8 @@ open class TabBar: Bar {
centerViews
=
buttons
as
[
UIView
]
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -152,7 +153,8 @@ open class TabBar: Bar {
/// A value for the line alignment.
open
var
lineAlignment
=
TabBarLineAlignment
.
bottom
{
didSet
{
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/TableViewCell.swift
View file @
777f4942
...
...
@@ -44,7 +44,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
/// A reference to the pulse layer.
internal
var
pulseLayer
:
CALayer
?
{
return
pulse
.
pulseL
ayer
return
pulse
.
l
ayer
}
/// PulseAnimation value.
...
...
@@ -180,7 +180,7 @@ open class TableViewCell: UITableViewCell, Pulseable, PulseableLayer {
extension
TableViewCell
{
/// Prepares the pulse motion.
fileprivate
func
preparePulse
()
{
pulse
=
Pulse
(
pulseView
:
self
,
pulseL
ayer
:
visualLayer
)
pulse
=
Pulse
(
view
:
self
,
l
ayer
:
visualLayer
)
}
/// Prepares the visualLayer property.
...
...
Sources/iOS/TextField.swift
View file @
777f4942
...
...
@@ -88,7 +88,8 @@ open class TextField: UITextField {
open
override
var
leftView
:
UIView
?
{
didSet
{
prepareLeftView
()
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -185,7 +186,8 @@ open class TextField: UITextField {
}
set
(
value
)
{
placeholderLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -225,7 +227,8 @@ open class TextField: UITextField {
}
set
(
value
)
{
detailLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -285,7 +288,8 @@ open class TextField: UITextField {
rightView
=
clearIconButton
isClearIconButtonAutoHandled
=
isClearIconButtonAutoHandled
?
true
:
false
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -332,7 +336,8 @@ open class TextField: UITextField {
rightView
=
visibilityIconButton
isVisibilityIconButtonAutoHandled
=
isVisibilityIconButtonAutoHandled
?
true
:
false
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
Sources/iOS/Toolbar.swift
View file @
777f4942
...
...
@@ -41,7 +41,8 @@ open class Toolbar: Bar {
}
set
(
value
)
{
titleLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
@@ -57,7 +58,8 @@ open class Toolbar: Bar {
}
set
(
value
)
{
detailLabel
.
text
=
value
layoutSubviews
()
setNeedsLayout
()
layoutIfNeeded
()
}
}
...
...
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