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