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
4674e69d
Commit
4674e69d
authored
Jul 15, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progression commit for Swift 2.3 refactor
parent
7407d97f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
382 additions
and
396 deletions
+382
-396
Material.xcodeproj/project.pbxproj
+0
-0
Sources/iOS/Border.swift
+25
-26
Sources/iOS/BottomTabBar.swift
+5
-5
Sources/iOS/Button.swift
+35
-35
Sources/iOS/Capture.swift
+3
-3
Sources/iOS/Card.swift
+18
-18
Sources/iOS/ControlView.swift
+4
-4
Sources/iOS/EdgeInsets.swift
+32
-70
Sources/iOS/FabButton.swift
+1
-1
Sources/iOS/FlatButton.swift
+1
-1
Sources/iOS/Grid.swift
+6
-6
Sources/iOS/ImageCard.swift
+18
-18
Sources/iOS/Layer.swift
+40
-35
Sources/iOS/MaterialCollectionReusableView.swift
+58
-55
Sources/iOS/MaterialCollectionView.swift
+3
-3
Sources/iOS/MaterialCollectionViewCell.swift
+27
-27
Sources/iOS/MaterialCollectionViewLayout.swift
+3
-3
Sources/iOS/MaterialKeyframeAnimation.swift
+2
-3
Sources/iOS/MaterialTableViewCell.swift
+12
-12
Sources/iOS/MenuView.swift
+1
-1
Sources/iOS/NavigationBar.swift
+9
-9
Sources/iOS/NavigationDrawerController.swift
+1
-1
Sources/iOS/Offset.swift
+18
-0
Sources/iOS/Radius.swift
+24
-24
Sources/iOS/RaisedButton.swift
+1
-1
Sources/iOS/Shape.swift
+4
-4
Sources/iOS/Switch.swift
+1
-1
Sources/iOS/TextField.swift
+1
-1
Sources/iOS/TextView.swift
+10
-10
Sources/iOS/View.swift
+19
-19
No files found.
Material.xcodeproj/project.pbxproj
View file @
4674e69d
This diff is collapsed.
Click to expand it.
Sources/iOS/
Material
Border.swift
→
Sources/iOS/Border.swift
View file @
4674e69d
...
@@ -30,41 +30,41 @@
...
@@ -30,41 +30,41 @@
import
UIKit
import
UIKit
public
enum
MaterialBorder
{
public
enum
BorderWidthPreset
{
case
N
one
case
n
one
case
B
order1
case
b
order1
case
B
order2
case
b
order2
case
B
order3
case
b
order3
case
B
order4
case
b
order4
case
B
order5
case
b
order5
case
B
order6
case
b
order6
case
B
order7
case
b
order7
case
B
order8
case
b
order8
case
B
order9
case
b
order9
}
}
/// Converts the
MaterialBorder
enum to a CGFloat value.
/// Converts the
BorderWidthPreset
enum to a CGFloat value.
public
func
MaterialBorderToValue
(
border
:
MaterialBorder
)
->
CGFloat
{
public
func
BorderWidthPresetToValue
(
preset
:
BorderWidthPreset
)
->
CGFloat
{
switch
border
{
switch
preset
{
case
.
N
one
:
case
.
n
one
:
return
0
return
0
case
.
B
order1
:
case
.
b
order1
:
return
0.5
return
0.5
case
.
B
order2
:
case
.
b
order2
:
return
1
return
1
case
.
B
order3
:
case
.
b
order3
:
return
2
return
2
case
.
B
order4
:
case
.
b
order4
:
return
3
return
3
case
.
B
order5
:
case
.
b
order5
:
return
4
return
4
case
.
B
order6
:
case
.
b
order6
:
return
5
return
5
case
.
B
order7
:
case
.
b
order7
:
return
6
return
6
case
.
B
order8
:
case
.
b
order8
:
return
7
return
7
case
.
B
order9
:
case
.
b
order9
:
return
8
return
8
}
}
}
}
\ No newline at end of file
Sources/iOS/BottomTabBar.swift
View file @
4674e69d
...
@@ -87,7 +87,7 @@ public class BottomTabBar: UITabBar {
...
@@ -87,7 +87,7 @@ public class BottomTabBar: UITabBar {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -102,7 +102,7 @@ public class BottomTabBar: UITabBar {
...
@@ -102,7 +102,7 @@ public class BottomTabBar: UITabBar {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -122,7 +122,7 @@ public class BottomTabBar: UITabBar {
...
@@ -122,7 +122,7 @@ public class BottomTabBar: UITabBar {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -152,9 +152,9 @@ public class BottomTabBar: UITabBar {
...
@@ -152,9 +152,9 @@ public class BottomTabBar: UITabBar {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
:
borderWidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
:
borderWidthPreset
)
}
}
}
}
...
...
Sources/iOS/Button.swift
View file @
4674e69d
...
@@ -107,7 +107,7 @@ public class Button: UIButton {
...
@@ -107,7 +107,7 @@ public class Button: UIButton {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -116,7 +116,7 @@ public class Button: UIButton {
...
@@ -116,7 +116,7 @@ public class Button: UIButton {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
}
}
}
}
...
@@ -125,7 +125,7 @@ public class Button: UIButton {
...
@@ -125,7 +125,7 @@ public class Button: UIButton {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -134,7 +134,7 @@ public class Button: UIButton {
...
@@ -134,7 +134,7 @@ public class Button: UIButton {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
}
}
}
}
...
@@ -148,12 +148,12 @@ public class Button: UIButton {
...
@@ -148,12 +148,12 @@ public class Button: UIButton {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
.
asOffset
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
shadowOffset
=
value
layer
.
shadowOffset
=
value
.
asSize
}
}
}
}
...
@@ -218,13 +218,13 @@ public class Button: UIButton {
...
@@ -218,13 +218,13 @@ public class Button: UIButton {
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
N
one
{
public
var
cornerRadiusPreset
:
RadiusPreset
=
.
n
one
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
radius
:
v
)
cornerRadius
=
RadiusPresetToValue
(
preset
:
v
)
}
}
}
}
}
}
...
@@ -237,8 +237,8 @@ public class Button: UIButton {
...
@@ -237,8 +237,8 @@ public class Button: UIButton {
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
circle
==
shapePreset
{
shape
=
.
N
one
shape
Preset
=
.
n
one
}
}
}
}
}
}
...
@@ -248,9 +248,9 @@ public class Button: UIButton {
...
@@ -248,9 +248,9 @@ public class Button: UIButton {
width or height property is set, the other will be automatically adjusted
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
to maintain the shape of the object.
*/
*/
public
var
shape
:
MaterialShape
=
.
N
one
{
public
var
shape
Preset
:
ShapePreset
=
.
n
one
{
didSet
{
didSet
{
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
if
width
<
height
{
if
width
<
height
{
frame
.
size
.
width
=
height
frame
.
size
.
width
=
height
}
else
{
}
else
{
...
@@ -262,9 +262,9 @@ public class Button: UIButton {
...
@@ -262,9 +262,9 @@ public class Button: UIButton {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
:
borderWidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
:
borderWidthPreset
)
}
}
}
}
...
@@ -309,16 +309,16 @@ public class Button: UIButton {
...
@@ -309,16 +309,16 @@ public class Button: UIButton {
}
}
/// A preset property for updated contentEdgeInsets.
/// A preset property for updated contentEdgeInsets.
public
var
content
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: contentInset
:name: contentInset
*/
*/
@IBInspectable
public
var
contentInset
=
Inset
.
zero
{
@IBInspectable
public
var
contentInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
contentEdgeInsets
=
contentInset
.
asEdgeInsets
contentEdgeInsets
=
contentInset
.
asEdgeInsets
}
}
...
@@ -363,7 +363,7 @@ public class Button: UIButton {
...
@@ -363,7 +363,7 @@ public class Button: UIButton {
}
}
public
override
func
alignmentRectInsets
()
->
UIEdgeInsets
{
public
override
func
alignmentRectInsets
()
->
UIEdgeInsets
{
return
UIEdgeInset
.
zero
return
UIEdgeInset
s
.
zero
}
}
/**
/**
...
@@ -403,17 +403,17 @@ public class Button: UIButton {
...
@@ -403,17 +403,17 @@ public class Button: UIButton {
if interrupted.
if interrupted.
*/
*/
public
override
func
animationDidStop
(
_
animation
:
CAAnimation
,
finished
flag
:
Bool
)
{
public
override
func
animationDidStop
(
_
animation
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
animation
as?
CAPropertyAnimation
{
if
let
a
=
animation
as?
CAPropertyAnimation
{
if
let
b
:
CABasicAnimation
=
a
as?
CABasicAnimation
{
if
let
b
=
a
as?
CABasicAnimation
{
if
let
v
:
AnyObject
=
b
.
toValue
{
if
let
v
=
b
.
toValue
{
if
let
k
:
String
=
b
.
keyPath
{
if
let
k
=
b
.
keyPath
{
layer
.
setValue
(
v
,
forKeyPath
:
k
)
layer
.
setValue
(
v
,
forKeyPath
:
k
)
layer
.
removeAnimation
(
forKey
:
k
)
layer
.
removeAnimation
(
forKey
:
k
)
}
}
}
}
}
}
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
animation
:
animation
,
finished
:
flag
)
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStop
?(
animation
:
animation
,
finished
:
flag
)
}
else
if
let
a
:
CAAnimationGroup
=
animation
as?
CAAnimationGroup
{
}
else
if
let
a
=
animation
as?
CAAnimationGroup
{
for
x
in
a
.
animations
!
{
for
x
in
a
.
animations
!
{
animationDidStop
(
x
,
finished
:
true
)
animationDidStop
(
x
,
finished
:
true
)
}
}
...
@@ -427,10 +427,10 @@ public class Button: UIButton {
...
@@ -427,10 +427,10 @@ public class Button: UIButton {
*/
*/
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
public
func
pulse
(
point
:
CGPoint
?
=
nil
)
{
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
let
p
:
CGPoint
=
nil
==
point
?
CGPoint
(
x
:
CGFloat
(
width
/
2
),
y
:
CGFloat
(
height
/
2
))
:
point
!
MaterialAnimation
.
pulseExpandAnimation
(
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
MaterialAnimation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
p
,
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
MaterialAnimation
.
delay
(
0.35
)
{
[
weak
self
]
in
MaterialAnimation
.
delay
(
time
:
0.35
)
{
[
weak
self
]
in
if
let
s
:
Button
=
self
{
if
let
s
=
self
{
MaterialAnimation
.
pulseContractAnimation
(
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
MaterialAnimation
.
pulseContractAnimation
(
layer
:
s
.
layer
,
visualLayer
:
s
.
visualLayer
,
pulseColor
:
s
.
pulseColor
,
pulseLayers
:
&
s
.
pulseLayers
,
pulseAnimation
:
s
.
pulseAnimation
)
}
}
}
}
}
}
...
@@ -443,7 +443,7 @@ public class Button: UIButton {
...
@@ -443,7 +443,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
with
:
event
)
super
.
touchesBegan
(
touches
,
with
:
event
)
MaterialAnimation
.
pulseExpandAnimation
(
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convertPoint
(
touches
.
first
!.
locationInView
(
self
),
fromLayer
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
MaterialAnimation
.
pulseExpandAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseOpacity
:
pulseOpacity
,
point
:
layer
.
convert
(
touches
.
first
!.
location
(
in
:
self
),
from
:
layer
),
width
:
width
,
height
:
height
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -454,7 +454,7 @@ public class Button: UIButton {
...
@@ -454,7 +454,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
with
:
event
)
super
.
touchesEnded
(
touches
,
with
:
event
)
MaterialAnimation
.
pulseContractAnimation
(
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
MaterialAnimation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -465,7 +465,7 @@ public class Button: UIButton {
...
@@ -465,7 +465,7 @@ public class Button: UIButton {
*/
*/
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
public
override
func
touchesCancelled
(
_
touches
:
Set
<
UITouch
>
,
with
event
:
UIEvent
?)
{
super
.
touchesCancelled
(
touches
,
with
:
event
)
super
.
touchesCancelled
(
touches
,
with
:
event
)
MaterialAnimation
.
pulseContractAnimation
(
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
MaterialAnimation
.
pulseContractAnimation
(
layer
:
layer
,
visualLayer
:
visualLayer
,
pulseColor
:
pulseColor
,
pulseLayers
:
&
pulseLayers
,
pulseAnimation
:
pulseAnimation
)
}
}
/**
/**
...
@@ -496,7 +496,7 @@ public class Button: UIButton {
...
@@ -496,7 +496,7 @@ public class Button: UIButton {
/// Manages the layout for the shape of the view instance.
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
if
.
circle
==
shapePreset
{
let
w
:
CGFloat
=
(
width
/
2
)
let
w
:
CGFloat
=
(
width
/
2
)
if
w
!=
cornerRadius
{
if
w
!=
cornerRadius
{
cornerRadius
=
w
cornerRadius
=
w
...
...
Sources/iOS/Capture.swift
View file @
4674e69d
...
@@ -203,14 +203,14 @@ public class Capture : View, UIGestureRecognizerDelegate {
...
@@ -203,14 +203,14 @@ public class Capture : View, UIGestureRecognizerDelegate {
}
}
/// Insets preset value for content.
/// Insets preset value for content.
public
var
content
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/// Content insert value.
/// Content insert value.
public
var
contentInset
:
Inset
=
Inset
PresetToValue
(
preset
:
.
square4
)
{
public
var
contentInset
:
Inset
=
EdgeInsets
PresetToValue
(
preset
:
.
square4
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
...
Sources/iOS/Card.swift
View file @
4674e69d
...
@@ -57,16 +57,16 @@ public class Card: PulseView {
...
@@ -57,16 +57,16 @@ public class Card: PulseView {
/**
/**
:name: dividerInsets
:name: dividerInsets
*/
*/
public
var
divider
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
divider
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
dividerInset
=
InsetPresetToValue
(
preset
:
dividerInset
Preset
)
dividerInset
=
EdgeInsetsPresetToValue
(
preset
:
dividerEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: dividerInset
:name: dividerInset
*/
*/
@IBInspectable
public
var
dividerInset
=
Inset
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
@IBInspectable
public
var
dividerInset
=
EdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -75,16 +75,16 @@ public class Card: PulseView {
...
@@ -75,16 +75,16 @@ public class Card: PulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
content
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: contentInset
:name: contentInset
*/
*/
@IBInspectable
public
var
contentInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
contentInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -93,16 +93,16 @@ public class Card: PulseView {
...
@@ -93,16 +93,16 @@ public class Card: PulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabel
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
titleLabel
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
titleLabelInset
=
InsetPresetToValue
(
preset
:
titleLabelInset
Preset
)
titleLabelInset
=
EdgeInsetsPresetToValue
(
preset
:
titleLabelEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: titleLabelInset
:name: titleLabelInset
*/
*/
@IBInspectable
public
var
titleLabelInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
titleLabelInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -120,16 +120,16 @@ public class Card: PulseView {
...
@@ -120,16 +120,16 @@ public class Card: PulseView {
/**
/**
:name: contentViewInsets
:name: contentViewInsets
*/
*/
public
var
contentView
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
contentView
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
contentViewInset
=
InsetPresetToValue
(
preset
:
contentViewInset
Preset
)
contentViewInset
=
EdgeInsetsPresetToValue
(
preset
:
contentViewEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: contentViewInset
:name: contentViewInset
*/
*/
@IBInspectable
public
var
contentViewInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
contentViewInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -147,16 +147,16 @@ public class Card: PulseView {
...
@@ -147,16 +147,16 @@ public class Card: PulseView {
/**
/**
:name: leftButtonsInsets
:name: leftButtonsInsets
*/
*/
public
var
leftButtons
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
leftButtons
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
leftButtonsInset
=
InsetPresetToValue
(
preset
:
leftButtonsInset
Preset
)
leftButtonsInset
=
EdgeInsetsPresetToValue
(
preset
:
leftButtonsEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: leftButtonsInset
:name: leftButtonsInset
*/
*/
@IBInspectable
public
var
leftButtonsInset
=
Inset
.
zero
{
@IBInspectable
public
var
leftButtonsInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -174,16 +174,16 @@ public class Card: PulseView {
...
@@ -174,16 +174,16 @@ public class Card: PulseView {
/**
/**
:name: rightButtonsInsets
:name: rightButtonsInsets
*/
*/
public
var
rightButtons
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
rightButtons
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
rightButtonsInset
=
InsetPresetToValue
(
preset
:
rightButtonsInset
Preset
)
rightButtonsInset
=
EdgeInsetsPresetToValue
(
preset
:
rightButtonsEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: rightButtonsInset
:name: rightButtonsInset
*/
*/
@IBInspectable
public
var
rightButtonsInset
=
Inset
.
zero
{
@IBInspectable
public
var
rightButtonsInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
...
Sources/iOS/ControlView.swift
View file @
4674e69d
...
@@ -37,12 +37,12 @@ public class ControlView : View {
...
@@ -37,12 +37,12 @@ public class ControlView : View {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
content
InsetPreset
:
Inset
Preset
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
{
get
{
get
{
return
grid
.
content
Inset
Preset
return
grid
.
content
EdgeInsets
Preset
}
}
set
(
value
)
{
set
(
value
)
{
grid
.
content
Inset
Preset
=
value
grid
.
content
EdgeInsets
Preset
=
value
}
}
}
}
...
@@ -227,7 +227,7 @@ public class ControlView : View {
...
@@ -227,7 +227,7 @@ public class ControlView : View {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
interimSpacePreset
=
.
interimSpace1
interimSpacePreset
=
.
interimSpace1
content
Inset
Preset
=
.
Square1
content
EdgeInsets
Preset
=
.
Square1
autoresizingMask
=
.
FlexibleWidth
autoresizingMask
=
.
FlexibleWidth
shadowPathAutoSizeEnabled
=
false
shadowPathAutoSizeEnabled
=
false
prepareContentView
()
prepareContentView
()
...
...
Sources/iOS/Insets.swift
→
Sources/iOS/
Edge
Insets.swift
View file @
4674e69d
...
@@ -32,7 +32,7 @@ import UIKit
...
@@ -32,7 +32,7 @@ import UIKit
import
UIKit
import
UIKit
public
enum
Inset
Preset
{
public
enum
EdgeInsets
Preset
{
case
none
case
none
// square
// square
...
@@ -69,110 +69,72 @@ public enum InsetPreset {
...
@@ -69,110 +69,72 @@ public enum InsetPreset {
case
tallRectangle9
case
tallRectangle9
}
}
public
struct
Inset
{
public
typealias
EdgeInsets
=
UIEdgeInsets
/// Top inset.
public
var
top
:
CGFloat
/// Left inset.
public
var
left
:
CGFloat
/// Bottom inset.
public
var
bottom
:
CGFloat
/// Right inset.
public
var
right
:
CGFloat
public
var
asEdgeInsets
:
UIEdgeInsets
{
return
UIEdgeInsets
(
top
:
top
,
left
:
left
,
bottom
:
bottom
,
right
:
right
)
}
/**
Initializer.
- Parameter top: Top inset.
- Parameter left: Left inset.
- Parameter bottom: Bottom inset.
- Parameter right: Right inset.
*/
public
init
(
top
:
CGFloat
=
0
,
left
:
CGFloat
=
0
,
bottom
:
CGFloat
=
0
,
right
:
CGFloat
=
0
)
{
self
.
top
=
top
self
.
left
=
left
self
.
bottom
=
bottom
self
.
right
=
right
}
/**
Static constructor for Inset with values of 0.
- Returns: An Inset struct with values of 0.
*/
static
var
zero
:
Inset
{
return
Inset
()
}
}
/// Converts the
Inset
Preset to a Inset value.
/// Converts the
EdgeInsets
Preset to a Inset value.
public
func
InsetPresetToValue
(
preset
:
InsetPreset
)
->
Inset
{
public
func
EdgeInsetsPresetToValue
(
preset
:
EdgeInsetsPreset
)
->
EdgeInsets
{
switch
preset
{
switch
preset
{
case
.
none
:
case
.
none
:
return
Inset
.
zero
return
EdgeInsets
.
zero
// square
// square
case
.
square1
:
case
.
square1
:
return
Inset
(
top
:
4
,
left
:
4
,
bottom
:
4
,
right
:
4
)
return
EdgeInsets
(
top
:
4
,
left
:
4
,
bottom
:
4
,
right
:
4
)
case
.
square2
:
case
.
square2
:
return
Inset
(
top
:
8
,
left
:
8
,
bottom
:
8
,
right
:
8
)
return
EdgeInsets
(
top
:
8
,
left
:
8
,
bottom
:
8
,
right
:
8
)
case
.
square3
:
case
.
square3
:
return
Inset
(
top
:
16
,
left
:
16
,
bottom
:
16
,
right
:
16
)
return
EdgeInsets
(
top
:
16
,
left
:
16
,
bottom
:
16
,
right
:
16
)
case
.
square4
:
case
.
square4
:
return
Inset
(
top
:
24
,
left
:
24
,
bottom
:
24
,
right
:
24
)
return
EdgeInsets
(
top
:
24
,
left
:
24
,
bottom
:
24
,
right
:
24
)
case
.
square5
:
case
.
square5
:
return
Inset
(
top
:
32
,
left
:
32
,
bottom
:
32
,
right
:
32
)
return
EdgeInsets
(
top
:
32
,
left
:
32
,
bottom
:
32
,
right
:
32
)
case
.
square6
:
case
.
square6
:
return
Inset
(
top
:
40
,
left
:
40
,
bottom
:
40
,
right
:
40
)
return
EdgeInsets
(
top
:
40
,
left
:
40
,
bottom
:
40
,
right
:
40
)
case
.
square7
:
case
.
square7
:
return
Inset
(
top
:
48
,
left
:
48
,
bottom
:
48
,
right
:
48
)
return
EdgeInsets
(
top
:
48
,
left
:
48
,
bottom
:
48
,
right
:
48
)
case
.
square8
:
case
.
square8
:
return
Inset
(
top
:
56
,
left
:
56
,
bottom
:
56
,
right
:
56
)
return
EdgeInsets
(
top
:
56
,
left
:
56
,
bottom
:
56
,
right
:
56
)
case
.
square9
:
case
.
square9
:
return
Inset
(
top
:
64
,
left
:
64
,
bottom
:
64
,
right
:
64
)
return
EdgeInsets
(
top
:
64
,
left
:
64
,
bottom
:
64
,
right
:
64
)
// rectangle
// rectangle
case
.
wideRectangle1
:
case
.
wideRectangle1
:
return
Inset
(
top
:
2
,
left
:
4
,
bottom
:
2
,
right
:
4
)
return
EdgeInsets
(
top
:
2
,
left
:
4
,
bottom
:
2
,
right
:
4
)
case
.
wideRectangle2
:
case
.
wideRectangle2
:
return
Inset
(
top
:
4
,
left
:
8
,
bottom
:
4
,
right
:
8
)
return
EdgeInsets
(
top
:
4
,
left
:
8
,
bottom
:
4
,
right
:
8
)
case
.
wideRectangle3
:
case
.
wideRectangle3
:
return
Inset
(
top
:
8
,
left
:
16
,
bottom
:
8
,
right
:
16
)
return
EdgeInsets
(
top
:
8
,
left
:
16
,
bottom
:
8
,
right
:
16
)
case
.
wideRectangle4
:
case
.
wideRectangle4
:
return
Inset
(
top
:
12
,
left
:
24
,
bottom
:
12
,
right
:
24
)
return
EdgeInsets
(
top
:
12
,
left
:
24
,
bottom
:
12
,
right
:
24
)
case
.
wideRectangle5
:
case
.
wideRectangle5
:
return
Inset
(
top
:
16
,
left
:
32
,
bottom
:
16
,
right
:
32
)
return
EdgeInsets
(
top
:
16
,
left
:
32
,
bottom
:
16
,
right
:
32
)
case
.
wideRectangle6
:
case
.
wideRectangle6
:
return
Inset
(
top
:
20
,
left
:
40
,
bottom
:
20
,
right
:
40
)
return
EdgeInsets
(
top
:
20
,
left
:
40
,
bottom
:
20
,
right
:
40
)
case
.
wideRectangle7
:
case
.
wideRectangle7
:
return
Inset
(
top
:
24
,
left
:
48
,
bottom
:
24
,
right
:
48
)
return
EdgeInsets
(
top
:
24
,
left
:
48
,
bottom
:
24
,
right
:
48
)
case
.
wideRectangle8
:
case
.
wideRectangle8
:
return
Inset
(
top
:
28
,
left
:
56
,
bottom
:
28
,
right
:
56
)
return
EdgeInsets
(
top
:
28
,
left
:
56
,
bottom
:
28
,
right
:
56
)
case
.
wideRectangle9
:
case
.
wideRectangle9
:
return
Inset
(
top
:
32
,
left
:
64
,
bottom
:
32
,
right
:
64
)
return
EdgeInsets
(
top
:
32
,
left
:
64
,
bottom
:
32
,
right
:
64
)
// flipped rectangle
// flipped rectangle
case
.
tallRectangle1
:
case
.
tallRectangle1
:
return
Inset
(
top
:
4
,
left
:
2
,
bottom
:
4
,
right
:
2
)
return
EdgeInsets
(
top
:
4
,
left
:
2
,
bottom
:
4
,
right
:
2
)
case
.
tallRectangle2
:
case
.
tallRectangle2
:
return
Inset
(
top
:
8
,
left
:
4
,
bottom
:
8
,
right
:
4
)
return
EdgeInsets
(
top
:
8
,
left
:
4
,
bottom
:
8
,
right
:
4
)
case
.
tallRectangle3
:
case
.
tallRectangle3
:
return
Inset
(
top
:
16
,
left
:
8
,
bottom
:
16
,
right
:
8
)
return
EdgeInsets
(
top
:
16
,
left
:
8
,
bottom
:
16
,
right
:
8
)
case
.
tallRectangle4
:
case
.
tallRectangle4
:
return
Inset
(
top
:
24
,
left
:
12
,
bottom
:
24
,
right
:
12
)
return
EdgeInsets
(
top
:
24
,
left
:
12
,
bottom
:
24
,
right
:
12
)
case
.
tallRectangle5
:
case
.
tallRectangle5
:
return
Inset
(
top
:
32
,
left
:
16
,
bottom
:
32
,
right
:
16
)
return
EdgeInsets
(
top
:
32
,
left
:
16
,
bottom
:
32
,
right
:
16
)
case
.
tallRectangle6
:
case
.
tallRectangle6
:
return
Inset
(
top
:
40
,
left
:
20
,
bottom
:
40
,
right
:
20
)
return
EdgeInsets
(
top
:
40
,
left
:
20
,
bottom
:
40
,
right
:
20
)
case
.
tallRectangle7
:
case
.
tallRectangle7
:
return
Inset
(
top
:
48
,
left
:
24
,
bottom
:
48
,
right
:
24
)
return
EdgeInsets
(
top
:
48
,
left
:
24
,
bottom
:
48
,
right
:
24
)
case
.
tallRectangle8
:
case
.
tallRectangle8
:
return
Inset
(
top
:
56
,
left
:
28
,
bottom
:
56
,
right
:
28
)
return
EdgeInsets
(
top
:
56
,
left
:
28
,
bottom
:
56
,
right
:
28
)
case
.
tallRectangle9
:
case
.
tallRectangle9
:
return
Inset
(
top
:
64
,
left
:
32
,
bottom
:
64
,
right
:
32
)
return
EdgeInsets
(
top
:
64
,
left
:
32
,
bottom
:
64
,
right
:
32
)
}
}
}
}
Sources/iOS/FabButton.swift
View file @
4674e69d
...
@@ -41,7 +41,7 @@ public class FabButton: Button {
...
@@ -41,7 +41,7 @@ public class FabButton: Button {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
shape
=
.
C
ircle
shape
=
.
c
ircle
pulseAnimation
=
.
CenterWithBacking
pulseAnimation
=
.
CenterWithBacking
pulseColor
=
Color
.
white
pulseColor
=
Color
.
white
tintColor
=
Color
.
white
tintColor
=
Color
.
white
...
...
Sources/iOS/FlatButton.swift
View file @
4674e69d
...
@@ -41,6 +41,6 @@ public class FlatButton: Button {
...
@@ -41,6 +41,6 @@ public class FlatButton: Button {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
Radius1
content
Inset
Preset
=
.
wideRectangle3
content
EdgeInsets
Preset
=
.
wideRectangle3
}
}
}
}
Sources/iOS/Grid.swift
View file @
4674e69d
...
@@ -129,28 +129,28 @@ public class Grid {
...
@@ -129,28 +129,28 @@ public class Grid {
public
private(set)
var
axis
:
GridAxis
!
public
private(set)
var
axis
:
GridAxis
!
/// Preset inset value for grid.
/// Preset inset value for grid.
public
var
layout
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
layout
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
layoutInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
layoutInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/// Insets value for grid.
/// Insets value for grid.
public
var
layoutInset
=
Inset
.
zero
{
public
var
layoutInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
reload
()
reload
()
}
}
}
}
/// Preset inset value for grid.
/// Preset inset value for grid.
public
var
content
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/// Insets value for grid.
/// Insets value for grid.
public
var
contentInset
:
Inset
=
Inset
PresetToValue
(
preset
:
.
none
)
{
public
var
contentInset
:
Inset
=
EdgeInsets
PresetToValue
(
preset
:
.
none
)
{
didSet
{
didSet
{
reload
()
reload
()
}
}
...
...
Sources/iOS/ImageCard.swift
View file @
4674e69d
...
@@ -57,16 +57,16 @@ public class ImageCard: PulseView {
...
@@ -57,16 +57,16 @@ public class ImageCard: PulseView {
/**
/**
:name: dividerInsets
:name: dividerInsets
*/
*/
public
var
divider
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
divider
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
dividerInset
=
InsetPresetToValue
(
preset
:
dividerInset
Preset
)
dividerInset
=
EdgeInsetsPresetToValue
(
preset
:
dividerEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: dividerInset
:name: dividerInset
*/
*/
@IBInspectable
public
var
dividerInset
=
Inset
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
@IBInspectable
public
var
dividerInset
=
EdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -168,16 +168,16 @@ public class ImageCard: PulseView {
...
@@ -168,16 +168,16 @@ public class ImageCard: PulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
content
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: contentInset
:name: contentInset
*/
*/
@IBInspectable
public
var
contentInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
contentInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -186,16 +186,16 @@ public class ImageCard: PulseView {
...
@@ -186,16 +186,16 @@ public class ImageCard: PulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabel
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
titleLabel
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
titleLabelInset
=
InsetPresetToValue
(
preset
:
titleLabelInset
Preset
)
titleLabelInset
=
EdgeInsetsPresetToValue
(
preset
:
titleLabelEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: titleLabelInset
:name: titleLabelInset
*/
*/
@IBInspectable
public
var
titleLabelInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
titleLabelInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -213,16 +213,16 @@ public class ImageCard: PulseView {
...
@@ -213,16 +213,16 @@ public class ImageCard: PulseView {
/**
/**
:name: contentViewInsets
:name: contentViewInsets
*/
*/
public
var
contentView
InsetPreset
:
Inset
Preset
=
.
square2
{
public
var
contentView
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
square2
{
didSet
{
didSet
{
contentViewInset
=
InsetPresetToValue
(
preset
:
contentViewInset
Preset
)
contentViewInset
=
EdgeInsetsPresetToValue
(
preset
:
contentViewEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: contentViewInset
:name: contentViewInset
*/
*/
@IBInspectable
public
var
contentViewInset
=
Inset
PresetToValue
(
preset
:
.
square2
)
{
@IBInspectable
public
var
contentViewInset
=
EdgeInsets
PresetToValue
(
preset
:
.
square2
)
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -240,16 +240,16 @@ public class ImageCard: PulseView {
...
@@ -240,16 +240,16 @@ public class ImageCard: PulseView {
/**
/**
:name: leftButtonsInsets
:name: leftButtonsInsets
*/
*/
public
var
leftButtons
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
leftButtons
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
leftButtonsInset
=
InsetPresetToValue
(
preset
:
leftButtonsInset
Preset
)
leftButtonsInset
=
EdgeInsetsPresetToValue
(
preset
:
leftButtonsEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: leftButtonsInset
:name: leftButtonsInset
*/
*/
@IBInspectable
public
var
leftButtonsInset
=
Inset
.
zero
{
@IBInspectable
public
var
leftButtonsInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
@@ -267,16 +267,16 @@ public class ImageCard: PulseView {
...
@@ -267,16 +267,16 @@ public class ImageCard: PulseView {
/**
/**
:name: rightButtonsInsets
:name: rightButtonsInsets
*/
*/
public
var
rightButtons
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
rightButtons
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
rightButtonsInset
=
InsetPresetToValue
(
preset
:
rightButtonsInset
Preset
)
rightButtonsInset
=
EdgeInsetsPresetToValue
(
preset
:
rightButtonsEdgeInsets
Preset
)
}
}
}
}
/**
/**
:name: rightButtonsInset
:name: rightButtonsInset
*/
*/
@IBInspectable
public
var
rightButtonsInset
=
Inset
.
zero
{
@IBInspectable
public
var
rightButtonsInset
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
reloadView
()
reloadView
()
}
}
...
...
Sources/iOS/Layer.swift
View file @
4674e69d
...
@@ -41,7 +41,7 @@ public class Layer: CAShapeLayer {
...
@@ -41,7 +41,7 @@ public class Layer: CAShapeLayer {
allows the dropshadow effect on the backing layer, while clipping
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
the image to a desired shape within the visualLayer.
*/
*/
public
private(set)
lazy
var
visualLayer
:
CAShapeLayer
=
CAShapeLayer
()
public
private(set)
var
visualLayer
:
CAShapeLayer
!
/// A property that accesses the layer.frame.origin.x property.
/// A property that accesses the layer.frame.origin.x property.
@IBInspectable
public
var
x
:
CGFloat
{
@IBInspectable
public
var
x
:
CGFloat
{
...
@@ -66,7 +66,7 @@ public class Layer: CAShapeLayer {
...
@@ -66,7 +66,7 @@ public class Layer: CAShapeLayer {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -75,7 +75,7 @@ public class Layer: CAShapeLayer {
...
@@ -75,7 +75,7 @@ public class Layer: CAShapeLayer {
}
}
set
(
value
)
{
set
(
value
)
{
frame
.
size
.
width
=
value
frame
.
size
.
width
=
value
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
frame
.
size
.
height
=
value
frame
.
size
.
height
=
value
}
}
}
}
...
@@ -84,7 +84,7 @@ public class Layer: CAShapeLayer {
...
@@ -84,7 +84,7 @@ public class Layer: CAShapeLayer {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -93,7 +93,7 @@ public class Layer: CAShapeLayer {
...
@@ -93,7 +93,7 @@ public class Layer: CAShapeLayer {
}
}
set
(
value
)
{
set
(
value
)
{
frame
.
size
.
height
=
value
frame
.
size
.
height
=
value
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
frame
.
size
.
width
=
value
frame
.
size
.
width
=
value
}
}
}
}
...
@@ -169,44 +169,49 @@ public class Layer: CAShapeLayer {
...
@@ -169,44 +169,49 @@ public class Layer: CAShapeLayer {
}
}
}
}
/**
/// A preset value for Depth.
public
var
depthPreset
:
DepthPreset
=
.
none
{
didSet
{
depth
=
DepthPresetToValue
(
preset
:
depthPreset
)
}
}
/**
A property that sets the shadowOffset, shadowOpacity, and shadowRadius
A property that sets the shadowOffset, shadowOpacity, and shadowRadius
for the backing layer. This is the preferred method of setting depth
for the backing layer.
in order to maintain consitency across UI objects.
*/
*/
public
var
depthPreset
=
.
none
{
public
var
depth
=
Depth
.
zero
{
didSet
{
didSet
{
let
value
:
Depth
=
DepthPresetToValue
(
preset
:
depth
)
shadowOffset
=
depth
.
offset
.
asSize
shadowOffset
=
value
.
offset
shadowOpacity
=
depth
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
depth
.
radius
shadowRadius
=
value
.
radius
layoutShadowPath
()
layoutShadowPath
()
}
}
}
}
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
N
one
{
public
var
cornerRadiusPreset
:
RadiusPreset
=
.
n
one
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
radius
:
v
)
cornerRadius
=
RadiusPresetToValue
(
preset
:
v
)
}
}
}
}
}
}
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
@IBInspectable
public
override
var
cornerRadius
:
CGFloat
{
@IBInspectable
public
override
var
cornerRadius
:
CGFloat
{
didSet
{
didSet
{
layoutShadowPath
()
layoutShadowPath
()
if
.
Circle
==
shape
{
if
.
circle
==
shapePreset
{
shape
=
.
N
one
shape
Preset
=
.
n
one
}
}
}
}
}
}
...
@@ -216,9 +221,9 @@ public class Layer: CAShapeLayer {
...
@@ -216,9 +221,9 @@ public class Layer: CAShapeLayer {
width or height property is set, the other will be automatically adjusted
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
to maintain the shape of the object.
*/
*/
public
var
shape
:
MaterialShape
=
.
N
one
{
public
var
shape
Preset
:
ShapePreset
=
.
n
one
{
didSet
{
didSet
{
if
.
None
!=
shape
{
if
.
none
!=
shapePreset
{
if
width
<
height
{
if
width
<
height
{
frame
.
size
.
width
=
height
frame
.
size
.
width
=
height
}
else
{
}
else
{
...
@@ -230,9 +235,9 @@ public class Layer: CAShapeLayer {
...
@@ -230,9 +235,9 @@ public class Layer: CAShapeLayer {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
:
borderWidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
:
borderWidthPreset
)
}
}
}
}
...
@@ -335,8 +340,8 @@ public class Layer: CAShapeLayer {
...
@@ -335,8 +340,8 @@ public class Layer: CAShapeLayer {
/// Prepares the visualLayer property.
/// Prepares the visualLayer property.
public
func
prepareVisualLayer
()
{
public
func
prepareVisualLayer
()
{
// visualLayer
visualLayer
=
CAShapeLayer
(
Z
visualLayer
.
zPosition
=
0
visualLayer
.
zPosition
=
0
visualLayer
.
masksToBounds
=
true
visualLayer
.
masksToBounds
=
true
addSublayer
(
visualLayer
)
addSublayer
(
visualLayer
)
}
}
...
@@ -349,8 +354,8 @@ public class Layer: CAShapeLayer {
...
@@ -349,8 +354,8 @@ public class Layer: CAShapeLayer {
/// Manages the layout for the shape of the layer instance.
/// Manages the layout for the shape of the layer instance.
internal
func
layoutShape
()
{
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
if
.
circle
==
shapePreset
{
let
w
:
CGFloat
=
(
width
/
2
)
let
w
=
width
/
2
if
w
!=
cornerRadius
{
if
w
!=
cornerRadius
{
cornerRadius
=
w
cornerRadius
=
w
}
}
...
@@ -360,7 +365,7 @@ public class Layer: CAShapeLayer {
...
@@ -360,7 +365,7 @@ public class Layer: CAShapeLayer {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
None
==
depth
{
if
.
none
==
depthPreset
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
...
...
Sources/iOS/MaterialCollectionReusableView.swift
View file @
4674e69d
This diff is collapsed.
Click to expand it.
Sources/iOS/MaterialCollectionView.swift
View file @
4674e69d
...
@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView {
...
@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
content
Inset
Preset
:
Insets
{
public
var
content
EdgeInsets
Preset
:
Insets
{
get
{
get
{
return
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
Inset
Preset
return
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
EdgeInsets
Preset
}
}
set
(
value
)
{
set
(
value
)
{
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
Inset
Preset
=
value
(
collectionViewLayout
as?
MaterialCollectionViewLayout
)
!.
content
EdgeInsets
Preset
=
value
}
}
}
}
...
...
Sources/iOS/MaterialCollectionViewCell.swift
View file @
4674e69d
...
@@ -133,12 +133,12 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -133,12 +133,12 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
content
InsetPreset
:
Inset
Preset
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
{
get
{
get
{
return
contentView
.
grid
.
content
Inset
Preset
return
contentView
.
grid
.
content
EdgeInsets
Preset
}
}
set
(
value
)
{
set
(
value
)
{
contentView
.
grid
.
content
Inset
Preset
=
value
contentView
.
grid
.
content
EdgeInsets
Preset
=
value
}
}
}
}
...
@@ -214,7 +214,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -214,7 +214,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -223,7 +223,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -223,7 +223,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
}
}
}
}
...
@@ -232,7 +232,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -232,7 +232,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -241,7 +241,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -241,7 +241,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
}
}
}
}
...
@@ -255,7 +255,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -255,7 +255,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -320,13 +320,13 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -320,13 +320,13 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
public
var
cornerRadiusPreset
:
MaterialRadius
{
public
var
cornerRadiusPreset
:
RadiusPreset
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadius
ToValue
(
v
)
cornerRadius
=
RadiusPreset
ToValue
(
v
)
}
}
}
}
}
}
...
@@ -339,8 +339,8 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -339,8 +339,8 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
layoutShadowPath
()
if
.
C
ircle
==
shape
{
if
.
c
ircle
==
shape
{
shape
=
.
N
one
shape
=
.
n
one
}
}
}
}
}
}
...
@@ -350,9 +350,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -350,9 +350,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
width or height property is set, the other will be automatically adjusted
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
to maintain the shape of the object.
*/
*/
public
var
shape
:
MaterialShape
{
public
var
shape
:
ShapePreset
{
didSet
{
didSet
{
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
if
width
<
height
{
if
width
<
height
{
frame
.
size
.
width
=
height
frame
.
size
.
width
=
height
}
else
{
}
else
{
...
@@ -364,9 +364,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -364,9 +364,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
WidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
WidthPreset
)
}
}
}
}
...
@@ -415,9 +415,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -415,9 +415,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
- Parameter aDecoder: A NSCoder instance.
- Parameter aDecoder: A NSCoder instance.
*/
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
depth
=
.
N
one
depth
=
.
n
one
cornerRadiusPreset
=
.
N
one
cornerRadiusPreset
=
.
n
one
shape
=
.
N
one
shape
=
.
n
one
contentsGravityPreset
=
.
ResizeAspectFill
contentsGravityPreset
=
.
ResizeAspectFill
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
prepareView
()
prepareView
()
...
@@ -430,9 +430,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -430,9 +430,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
- Parameter frame: A CGRect instance.
- Parameter frame: A CGRect instance.
*/
*/
public
override
init
(
frame
:
CGRect
)
{
public
override
init
(
frame
:
CGRect
)
{
depth
=
.
N
one
depth
=
.
n
one
cornerRadiusPreset
=
.
N
one
cornerRadiusPreset
=
.
n
one
shape
=
.
N
one
shape
=
.
n
one
contentsGravityPreset
=
.
ResizeAspectFill
contentsGravityPreset
=
.
ResizeAspectFill
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
prepareView
()
prepareView
()
...
@@ -585,7 +585,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -585,7 +585,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// Manages the layout for the shape of the view instance.
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
internal
func
layoutShape
()
{
if
.
C
ircle
==
shape
{
if
.
c
ircle
==
shape
{
let
w
:
CGFloat
=
(
width
/
2
)
let
w
:
CGFloat
=
(
width
/
2
)
if
w
!=
cornerRadius
{
if
w
!=
cornerRadius
{
cornerRadius
=
w
cornerRadius
=
w
...
@@ -596,7 +596,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
...
@@ -596,7 +596,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
N
one
==
depth
{
if
.
n
one
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
...
...
Sources/iOS/MaterialCollectionViewLayout.swift
View file @
4674e69d
...
@@ -38,14 +38,14 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout {
...
@@ -38,14 +38,14 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout {
public
var
itemSize
:
CGSize
=
CGSize
.
zero
public
var
itemSize
:
CGSize
=
CGSize
.
zero
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
content
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/// A wrapper around grid.contentInset.
/// A wrapper around grid.contentInset.
public
var
contentInset
=
Inset
.
zero
public
var
contentInset
=
EdgeInsets
.
zero
/// Size of the content.
/// Size of the content.
public
private(set)
var
contentSize
:
CGSize
=
CGSize
.
zero
public
private(set)
var
contentSize
:
CGSize
=
CGSize
.
zero
...
...
Sources/iOS/MaterialKeyframeAnimation.swift
View file @
4674e69d
...
@@ -43,7 +43,7 @@ public enum MaterialAnimationRotationMode {
...
@@ -43,7 +43,7 @@ public enum MaterialAnimationRotationMode {
*/
*/
public
func
MaterialAnimationRotationModeToValue
(
mode
:
MaterialAnimationRotationMode
)
->
MaterialAnimationRotationModeType
?
{
public
func
MaterialAnimationRotationModeToValue
(
mode
:
MaterialAnimationRotationMode
)
->
MaterialAnimationRotationModeType
?
{
switch
mode
{
switch
mode
{
case
.
N
one
:
case
.
n
one
:
return
nil
return
nil
case
.
Auto
:
case
.
Auto
:
return
kCAAnimationRotateAuto
return
kCAAnimationRotateAuto
...
@@ -66,4 +66,4 @@ public extension MaterialAnimation {
...
@@ -66,4 +66,4 @@ public extension MaterialAnimation {
}
}
return
animation
return
animation
}
}
}
}
\ No newline at end of file
Sources/iOS/MaterialTableViewCell.swift
View file @
4674e69d
...
@@ -106,7 +106,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -106,7 +106,7 @@ public class MaterialTableViewCell : UITableViewCell {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -121,7 +121,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -121,7 +121,7 @@ public class MaterialTableViewCell : UITableViewCell {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -141,7 +141,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -141,7 +141,7 @@ public class MaterialTableViewCell : UITableViewCell {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -211,13 +211,13 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -211,13 +211,13 @@ public class MaterialTableViewCell : UITableViewCell {
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
N
one
{
public
var
cornerRadiusPreset
:
RadiusPreset
=
.
n
one
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
radius
:
v
)
cornerRadius
=
RadiusPresetToValue
(
preset
:
v
)
}
}
}
}
}
}
...
@@ -234,9 +234,9 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -234,9 +234,9 @@ public class MaterialTableViewCell : UITableViewCell {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
:
borderWidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
:
borderWidthPreset
)
}
}
}
}
...
@@ -421,7 +421,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -421,7 +421,7 @@ public class MaterialTableViewCell : UITableViewCell {
when subclassing.
when subclassing.
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
selectionStyle
=
.
N
one
selectionStyle
=
.
n
one
separatorInset
=
UIEdgeInsetsZero
separatorInset
=
UIEdgeInsetsZero
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
imageView
?
.
isUserInteractionEnabled
=
false
imageView
?
.
isUserInteractionEnabled
=
false
...
@@ -446,7 +446,7 @@ public class MaterialTableViewCell : UITableViewCell {
...
@@ -446,7 +446,7 @@ public class MaterialTableViewCell : UITableViewCell {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
N
one
==
depth
{
if
.
n
one
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
...
...
Sources/iOS/MenuView.swift
View file @
4674e69d
...
@@ -50,7 +50,7 @@ public class MenuView : PulseView {
...
@@ -50,7 +50,7 @@ public class MenuView : PulseView {
*/
*/
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
pulseAnimation
=
.
N
one
pulseAnimation
=
.
n
one
clipsToBounds
=
false
clipsToBounds
=
false
backgroundColor
=
nil
backgroundColor
=
nil
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
4674e69d
...
@@ -62,14 +62,14 @@ public class NavigationBar : UINavigationBar {
...
@@ -62,14 +62,14 @@ public class NavigationBar : UINavigationBar {
}
}
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
public
var
content
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
content
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
contentInset
=
InsetPresetToValue
(
preset
:
contentInset
Preset
)
contentInset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsets
Preset
)
}
}
}
}
/// A wrapper around grid.contentInset.
/// A wrapper around grid.contentInset.
@IBInspectable
public
var
contentInset
:
Insets
=
Inset
.
zero
{
@IBInspectable
public
var
contentInset
:
Insets
=
EdgeInsets
.
zero
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -157,7 +157,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -157,7 +157,7 @@ public class NavigationBar : UINavigationBar {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -172,7 +172,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -172,7 +172,7 @@ public class NavigationBar : UINavigationBar {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -192,7 +192,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -192,7 +192,7 @@ public class NavigationBar : UINavigationBar {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -236,9 +236,9 @@ public class NavigationBar : UINavigationBar {
...
@@ -236,9 +236,9 @@ public class NavigationBar : UINavigationBar {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
WidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
WidthPreset
)
}
}
}
}
...
@@ -433,7 +433,7 @@ public class NavigationBar : UINavigationBar {
...
@@ -433,7 +433,7 @@ public class NavigationBar : UINavigationBar {
translucent
=
false
translucent
=
false
depth
=
.
depth1
depth
=
.
depth1
interimSpacePreset
=
.
interimSpace1
interimSpacePreset
=
.
interimSpace1
content
Inset
Preset
=
.
Square1
content
EdgeInsets
Preset
=
.
Square1
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
backButtonImage
=
Icon
.
cm
.
arrowBack
backButtonImage
=
Icon
.
cm
.
arrowBack
let
image
:
UIImage
?
=
UIImage
.
imageWithColor
(
Color
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
let
image
:
UIImage
?
=
UIImage
.
imageWithColor
(
Color
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
...
...
Sources/iOS/NavigationDrawerController.swift
View file @
4674e69d
...
@@ -1098,7 +1098,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
...
@@ -1098,7 +1098,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
- Parameter container: A container view.
- Parameter container: A container view.
*/
*/
private
func
hideView
(
container
:
View
)
{
private
func
hideView
(
container
:
View
)
{
container
.
depth
=
.
N
one
container
.
depth
=
.
n
one
container
.
isHidden
=
true
container
.
isHidden
=
true
}
}
}
}
Sources/iOS/Offset.swift
View file @
4674e69d
...
@@ -32,7 +32,25 @@ import UIKit
...
@@ -32,7 +32,25 @@ import UIKit
public
typealias
Offset
=
UIOffset
public
typealias
Offset
=
UIOffset
public
extension
CGSize
{
/// Returns an Offset version of the CGSize.
public
var
asOffset
:
Offset
{
return
Offset
(
size
:
self
)
}
}
public
extension
Offset
{
/**
Initializer that accepts a CGSize value.
- Parameter size: A CGSize value.
*/
public
init
(
size
:
CGSize
)
{
self
.
init
(
horizontal
:
size
.
width
,
vertical
:
size
.
height
)
}
}
public
extension
Offset
{
public
extension
Offset
{
/// Returns a CGSize version of the Offset.
public
var
asSize
:
CGSize
{
public
var
asSize
:
CGSize
{
return
CGSize
(
width
:
horizontal
,
height
:
vertical
)
return
CGSize
(
width
:
horizontal
,
height
:
vertical
)
}
}
...
...
Sources/iOS/
Material
Radius.swift
→
Sources/iOS/Radius.swift
View file @
4674e69d
...
@@ -30,41 +30,41 @@
...
@@ -30,41 +30,41 @@
import
UIKit
import
UIKit
public
enum
MaterialRadius
{
public
enum
RadiusPreset
{
case
N
one
case
n
one
case
R
adius1
case
r
adius1
case
R
adius2
case
r
adius2
case
R
adius3
case
r
adius3
case
R
adius4
case
r
adius4
case
R
adius5
case
r
adius5
case
R
adius6
case
r
adius6
case
R
adius7
case
r
adius7
case
R
adius8
case
r
adius8
case
R
adius9
case
r
adius9
}
}
/// Converts the
MaterialRadius
enum to a CGFloat value.
/// Converts the
RadiusPreset
enum to a CGFloat value.
public
func
MaterialRadiusToValue
(
radius
:
MaterialRadius
)
->
CGFloat
{
public
func
RadiusPresetToValue
(
preset
:
RadiusPreset
)
->
CGFloat
{
switch
radius
{
switch
preset
{
case
.
N
one
:
case
.
n
one
:
return
0
return
0
case
.
R
adius1
:
case
.
r
adius1
:
return
4
return
4
case
.
R
adius2
:
case
.
r
adius2
:
return
8
return
8
case
.
R
adius3
:
case
.
r
adius3
:
return
16
return
16
case
.
R
adius4
:
case
.
r
adius4
:
return
24
return
24
case
.
R
adius5
:
case
.
r
adius5
:
return
32
return
32
case
.
R
adius6
:
case
.
r
adius6
:
return
40
return
40
case
.
R
adius7
:
case
.
r
adius7
:
return
48
return
48
case
.
R
adius8
:
case
.
r
adius8
:
return
56
return
56
case
.
R
adius9
:
case
.
r
adius9
:
return
64
return
64
}
}
}
}
Sources/iOS/RaisedButton.swift
View file @
4674e69d
...
@@ -42,7 +42,7 @@ public class RaisedButton: Button {
...
@@ -42,7 +42,7 @@ public class RaisedButton: Button {
super
.
prepareView
()
super
.
prepareView
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
Radius1
content
Inset
Preset
=
.
wideRectangle3
content
EdgeInsets
Preset
=
.
wideRectangle3
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
}
}
}
}
Sources/iOS/
Material
Shape.swift
→
Sources/iOS/Shape.swift
View file @
4674e69d
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
*/
public
enum
MaterialShape
{
public
enum
ShapePreset
{
case
N
one
case
n
one
case
S
quare
case
s
quare
case
C
ircle
case
c
ircle
}
}
Sources/iOS/Switch.swift
View file @
4674e69d
...
@@ -438,7 +438,7 @@ public class Switch: UIControl {
...
@@ -438,7 +438,7 @@ public class Switch: UIControl {
/// Prepares the button.
/// Prepares the button.
private
func
prepareButton
()
{
private
func
prepareButton
()
{
button
.
pulseAnimation
=
.
N
one
button
.
pulseAnimation
=
.
n
one
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpInside
)
,
for
:
.
touchUpInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpInside
)
,
for
:
.
touchUpInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchDragInside
)
,
for
:
.
touchDragInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchDragInside
)
,
for
:
.
touchDragInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpOutsideOrCanceled
)
,
for
:
.
touchCancel
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpOutsideOrCanceled
)
,
for
:
.
touchCancel
)
...
...
Sources/iOS/TextField.swift
View file @
4674e69d
...
@@ -468,7 +468,7 @@ public class TextField : UITextField {
...
@@ -468,7 +468,7 @@ public class TextField : UITextField {
public
func
prepareView
()
{
public
func
prepareView
()
{
super
.
placeholder
=
nil
super
.
placeholder
=
nil
masksToBounds
=
false
masksToBounds
=
false
borderStyle
=
.
N
one
borderStyle
=
.
n
one
backgroundColor
=
nil
backgroundColor
=
nil
textColor
=
Color
.
darkText
.
primary
textColor
=
Color
.
darkText
.
primary
font
=
RobotoFont
.
regularWithSize
(
16
)
font
=
RobotoFont
.
regularWithSize
(
16
)
...
...
Sources/iOS/TextView.swift
View file @
4674e69d
...
@@ -104,7 +104,7 @@ public class TextView: UITextView {
...
@@ -104,7 +104,7 @@ public class TextView: UITextView {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -168,10 +168,10 @@ public class TextView: UITextView {
...
@@ -168,10 +168,10 @@ public class TextView: UITextView {
}
}
/// A property that sets the cornerRadius of the backing layer.
/// A property that sets the cornerRadius of the backing layer.
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
N
one
{
public
var
cornerRadiusPreset
:
RadiusPreset
=
.
n
one
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadius
ToValue
(
v
)
cornerRadius
=
RadiusPreset
ToValue
(
v
)
}
}
}
}
}
}
...
@@ -188,9 +188,9 @@ public class TextView: UITextView {
...
@@ -188,9 +188,9 @@ public class TextView: UITextView {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
WidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
WidthPreset
)
}
}
}
}
...
@@ -286,9 +286,9 @@ public class TextView: UITextView {
...
@@ -286,9 +286,9 @@ public class TextView: UITextView {
Text container UIEdgeInset preset property. This updates the
Text container UIEdgeInset preset property. This updates the
textContainerInset property with a preset value.
textContainerInset property with a preset value.
*/
*/
public
var
textContainer
InsetPreset
:
Inset
Preset
=
.
none
{
public
var
textContainer
EdgeInsetsPreset
:
EdgeInsets
Preset
=
.
none
{
didSet
{
didSet
{
textContainerInset
=
InsetPresetToValue
(
preset
:
textContainerInset
Preset
)
textContainerInset
=
EdgeInsetsPresetToValue
(
preset
:
textContainerEdgeInsets
Preset
)
}
}
}
}
...
@@ -440,7 +440,7 @@ public class TextView: UITextView {
...
@@ -440,7 +440,7 @@ public class TextView: UITextView {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
N
one
==
depth
{
if
.
n
one
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
...
@@ -459,7 +459,7 @@ public class TextView: UITextView {
...
@@ -459,7 +459,7 @@ public class TextView: UITextView {
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
textContainerInset
=
Inset
.
zero
textContainerInset
=
EdgeInsets
.
zero
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
masksToBounds
=
false
masksToBounds
=
false
removeNotificationHandlers
()
removeNotificationHandlers
()
...
...
Sources/iOS/View.swift
View file @
4674e69d
...
@@ -159,7 +159,7 @@ public class View: UIView {
...
@@ -159,7 +159,7 @@ public class View: UIView {
/**
/**
A property that accesses the layer.frame.size.width property.
A property that accesses the layer.frame.size.width property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the height will be adjusted to maintain the correct
value that is not .
n
one, the height will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
width
:
CGFloat
{
@IBInspectable
public
var
width
:
CGFloat
{
...
@@ -168,7 +168,7 @@ public class View: UIView {
...
@@ -168,7 +168,7 @@ public class View: UIView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
}
}
}
}
...
@@ -177,7 +177,7 @@ public class View: UIView {
...
@@ -177,7 +177,7 @@ public class View: UIView {
/**
/**
A property that accesses the layer.frame.size.height property.
A property that accesses the layer.frame.size.height property.
When setting this property in conjunction with the shape property having a
When setting this property in conjunction with the shape property having a
value that is not .
N
one, the width will be adjusted to maintain the correct
value that is not .
n
one, the width will be adjusted to maintain the correct
shape.
shape.
*/
*/
@IBInspectable
public
var
height
:
CGFloat
{
@IBInspectable
public
var
height
:
CGFloat
{
...
@@ -186,7 +186,7 @@ public class View: UIView {
...
@@ -186,7 +186,7 @@ public class View: UIView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
}
}
}
}
...
@@ -200,7 +200,7 @@ public class View: UIView {
...
@@ -200,7 +200,7 @@ public class View: UIView {
}
}
/// A property that accesses the backing layer's shadowOffset.
/// A property that accesses the backing layer's shadowOffset.
@IBInspectable
public
var
shadowOffset
:
CGSize
{
@IBInspectable
public
var
shadowOffset
:
Offset
{
get
{
get
{
return
layer
.
shadowOffset
return
layer
.
shadowOffset
}
}
...
@@ -261,7 +261,7 @@ public class View: UIView {
...
@@ -261,7 +261,7 @@ public class View: UIView {
*/
*/
public
var
depth
=
Depth
.
zero
{
public
var
depth
=
Depth
.
zero
{
didSet
{
didSet
{
shadowOffset
=
depth
.
offset
.
asSize
shadowOffset
=
depth
.
offset
shadowOpacity
=
depth
.
opacity
shadowOpacity
=
depth
.
opacity
shadowRadius
=
depth
.
radius
shadowRadius
=
depth
.
radius
layoutShadowPath
()
layoutShadowPath
()
...
@@ -270,13 +270,13 @@ public class View: UIView {
...
@@ -270,13 +270,13 @@ public class View: UIView {
/**
/**
A property that sets the cornerRadius of the backing layer. If the shape
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .
C
ircle when the cornerRadius is set, it will
property has a value of .
c
ircle when the cornerRadius is set, it will
become .
N
one, as it no longer maintains its circle shape.
become .
n
one, as it no longer maintains its circle shape.
*/
*/
public
var
cornerRadiusPreset
:
MaterialRadius
=
.
N
one
{
public
var
cornerRadiusPreset
:
RadiusPreset
=
.
n
one
{
didSet
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
if
let
v
:
RadiusPreset
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
radius
:
v
)
cornerRadius
=
RadiusPresetToValue
(
preset
:
v
)
}
}
}
}
}
}
...
@@ -289,8 +289,8 @@ public class View: UIView {
...
@@ -289,8 +289,8 @@ public class View: UIView {
set
(
value
)
{
set
(
value
)
{
layer
.
cornerRadius
=
value
layer
.
cornerRadius
=
value
layoutShadowPath
()
layoutShadowPath
()
if
.
C
ircle
==
shape
{
if
.
c
ircle
==
shape
{
shape
=
.
N
one
shape
=
.
n
one
}
}
}
}
}
}
...
@@ -300,9 +300,9 @@ public class View: UIView {
...
@@ -300,9 +300,9 @@ public class View: UIView {
width or height property is set, the other will be automatically adjusted
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
to maintain the shape of the object.
*/
*/
public
var
shape
:
MaterialShape
=
.
N
one
{
public
var
shape
:
ShapePreset
=
.
n
one
{
didSet
{
didSet
{
if
.
N
one
!=
shape
{
if
.
n
one
!=
shape
{
if
width
<
height
{
if
width
<
height
{
frame
.
size
.
width
=
height
frame
.
size
.
width
=
height
}
else
{
}
else
{
...
@@ -314,9 +314,9 @@ public class View: UIView {
...
@@ -314,9 +314,9 @@ public class View: UIView {
}
}
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
N
one
{
public
var
borderWidthPreset
:
BorderWidthPreset
=
.
n
one
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
border
:
borderWidthPreset
)
borderWidth
=
BorderWidthPresetToValue
(
preset
:
borderWidthPreset
)
}
}
}
}
...
@@ -482,7 +482,7 @@ public class View: UIView {
...
@@ -482,7 +482,7 @@ public class View: UIView {
/// Manages the layout for the shape of the view instance.
/// Manages the layout for the shape of the view instance.
internal
func
layoutShape
()
{
internal
func
layoutShape
()
{
if
.
C
ircle
==
shape
{
if
.
c
ircle
==
shape
{
let
w
:
CGFloat
=
(
width
/
2
)
let
w
:
CGFloat
=
(
width
/
2
)
if
w
!=
cornerRadius
{
if
w
!=
cornerRadius
{
cornerRadius
=
w
cornerRadius
=
w
...
@@ -493,7 +493,7 @@ public class View: UIView {
...
@@ -493,7 +493,7 @@ public class View: UIView {
/// Sets the shadow path.
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
internal
func
layoutShadowPath
()
{
if
shadowPathAutoSizeEnabled
{
if
shadowPathAutoSizeEnabled
{
if
.
N
one
==
depth
{
if
.
n
one
==
depth
{
shadowPath
=
nil
shadowPath
=
nil
}
else
if
nil
==
shadowPath
{
}
else
if
nil
==
shadowPath
{
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
shadowPath
=
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
cgPath
...
...
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