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
5bf2f0a9
Commit
5bf2f0a9
authored
Oct 12, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated internals for visualLayer
parent
0bdc0c24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
80 additions
and
143 deletions
+80
-143
MaterialKit.xcodeproj/project.pbxproj
+6
-12
Source/BasicCardView.swift
+0
-0
Source/CardView.swift
+37
-39
Source/FabButton.swift
+0
-2
Source/FlatButton.swift
+0
-1
Source/MaterialCollectionViewCell.swift
+0
-1
Source/MaterialLayer.swift
+14
-10
Source/MaterialPulseView.swift
+0
-2
Source/MaterialTheme.swift
+4
-63
Source/MaterialView.swift
+19
-10
Source/NavigationBarView.swift
+0
-2
Source/RaisedButton.swift
+0
-1
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
5bf2f0a9
...
...
@@ -7,7 +7,6 @@
objects
=
{
/* Begin PBXBuildFile section */
6585D21A1BBCDFBF00426D22
/* BasicCardView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
65AD15EA1BC05B3A0068AF9C
/* MaterialLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65AD15E91BC05B3A0068AF9C
/* MaterialLayer.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1471BB5B916006F7F2B
/* MaterialView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1461BB5B916006F7F2B
/* MaterialView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1491BB5DC98006F7F2B
/* MaterialColor.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1481BB5DC98006F7F2B
/* MaterialColor.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
...
...
@@ -57,12 +56,11 @@
964B17D41BBB31C2002A9CA0
/* FabButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD17B1BB99E29006F7F2B
/* FabButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D51BBB31C2002A9CA0
/* MaterialAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D61BBB31C2002A9CA0
/* MaterialLayout.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
965C17C51BC8273D00B1059A
/* MaterialCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965C17C41BC8273D00B1059A
/* MaterialCollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
965C17C71BC8279F00B1059A
/* BasicCollectionViewCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965C17C61BC8279F00B1059A
/* BasicCollectionViewCell.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
965C17C81BC82FEF00B1059A
/* MaterialLayer.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65AD15E91BC05B3A0068AF9C
/* MaterialLayer.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965C17C91BC82FEF00B1059A
/* MaterialTextLayer.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9699879B1BC5FE49006D678E
/* MaterialTextLayer.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965C17CA1BC82FEF00B1059A
/*
ImageCardView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D26BFC1BC23649006478BD
/* Image
CardView.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965C17CA1BC82FEF00B1059A
/*
CardView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D26BFC1BC23649006478BD
/*
CardView.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965C17CB1BC82FEF00B1059A
/* MaterialCollectionViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965C17C41BC8273D00B1059A
/* MaterialCollectionViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
965C17CC1BC82FEF00B1059A
/* BasicCollectionViewCell.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965C17C61BC8279F00B1059A
/* BasicCollectionViewCell.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9693BF861BCB0E0A0087054A
/* Material+UIFont.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9693BF851BCB0E0A0087054A
/* Material+UIFont.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
...
...
@@ -74,7 +72,7 @@
9693BF8F1BCB35910087054A
/* MaterialTransitionAnimation.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96C4FABD1BC3168900E4FFC3
/* MaterialTransitionAnimation.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9699879C1BC5FE49006D678E
/* MaterialTextLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9699879B1BC5FE49006D678E
/* MaterialTextLayer.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
96C4FABE1BC3168900E4FFC3
/* MaterialTransitionAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96C4FABD1BC3168900E4FFC3
/* MaterialTransitionAnimation.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
96D26BFD1BC23649006478BD
/*
ImageCardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D26BFC1BC23649006478BD
/* Image
CardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
96D26BFD1BC23649006478BD
/*
CardView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D26BFC1BC23649006478BD
/*
CardView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
9A94D0FA1B895EA500F586A5
/* LICENSE in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832631B88E5BF0015F710
/* LICENSE */
;
};
9A94D0FB1B895EA500F586A5
/* Roboto-Regular.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
;
};
9A94D0FC1B895EA500F586A5
/* Roboto-Medium.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
;
};
...
...
@@ -124,14 +122,13 @@
963832631B88E5BF0015F710
/* LICENSE */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text
;
path
=
LICENSE
;
sourceTree
=
"<group>"
;
};
964B17B31BBA447F002A9CA0
/* MaterialLayout.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLayout.swift
;
sourceTree
=
"<group>"
;
};
964B17B51BBA4BEA002A9CA0
/* MaterialStatusBarStyle.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialStatusBarStyle.swift
;
sourceTree
=
"<group>"
;
};
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCardView.swift
;
sourceTree
=
"<group>"
;
};
965C17C41BC8273D00B1059A
/* MaterialCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
965C17C61BC8279F00B1059A
/* BasicCollectionViewCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BasicCollectionViewCell.swift
;
sourceTree
=
"<group>"
;
};
9693BF851BCB0E0A0087054A
/* Material+UIFont.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIFont.swift"
;
sourceTree
=
"<group>"
;
};
9693BF891BCB35520087054A
/* SideNavigationViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SideNavigationViewController.swift
;
sourceTree
=
"<group>"
;
};
9699879B1BC5FE49006D678E
/* MaterialTextLayer.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTextLayer.swift
;
sourceTree
=
"<group>"
;
};
96C4FABD1BC3168900E4FFC3
/* MaterialTransitionAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialTransitionAnimation.swift
;
sourceTree
=
"<group>"
;
};
96D26BFC1BC23649006478BD
/*
ImageCardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Image
CardView.swift
;
sourceTree
=
"<group>"
;
};
96D26BFC1BC23649006478BD
/*
CardView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CardView.swift
;
sourceTree
=
"<group>"
;
};
9AAC38551B8956C500FE6B2D
/* Roboto-Light.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Light.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38571B8956CF00FE6B2D
/* Roboto-Medium.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Medium.ttf"
;
sourceTree
=
"<group>"
;
};
9AAC38591B8956E300FE6B2D
/* Roboto-Regular.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Regular.ttf"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -292,8 +289,7 @@
964B17D71BBB38E2002A9CA0
/* Card */
=
{
isa
=
PBXGroup
;
children
=
(
964B17D81BBB3911002A9CA0
/* BasicCardView.swift */
,
96D26BFC1BC23649006478BD
/* ImageCardView.swift */
,
96D26BFC1BC23649006478BD
/* CardView.swift */
,
);
name
=
Card
;
sourceTree
=
"<group>"
;
...
...
@@ -377,10 +373,9 @@
964B17D41BBB31C2002A9CA0
/* FabButton.swift in Headers */
,
964B17D51BBB31C2002A9CA0
/* MaterialAnimation.swift in Headers */
,
964B17D61BBB31C2002A9CA0
/* MaterialLayout.swift in Headers */
,
6585D21A1BBCDFBF00426D22
/* BasicCardView.swift in Headers */
,
965C17C81BC82FEF00B1059A
/* MaterialLayer.swift in Headers */
,
965C17C91BC82FEF00B1059A
/* MaterialTextLayer.swift in Headers */
,
965C17CA1BC82FEF00B1059A
/*
Image
CardView.swift in Headers */
,
965C17CA1BC82FEF00B1059A
/* CardView.swift in Headers */
,
965C17CB1BC82FEF00B1059A
/* MaterialCollectionViewCell.swift in Headers */
,
965C17CC1BC82FEF00B1059A
/* BasicCollectionViewCell.swift in Headers */
,
9693BF8B1BCB35910087054A
/* Material+UIFont.swift in Headers */
,
...
...
@@ -500,8 +495,7 @@
65BDD16C1BB88D1A006F7F2B
/* MaterialShape.swift in Sources */
,
65AD15EA1BC05B3A0068AF9C
/* MaterialLayer.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
964B17D91BBB3911002A9CA0
/* BasicCardView.swift in Sources */
,
96D26BFD1BC23649006478BD
/* ImageCardView.swift in Sources */
,
96D26BFD1BC23649006478BD
/* CardView.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
65BDD1791BB99C0F006F7F2B
/* RaisedButton.swift in Sources */
,
964B17B41BBA447F002A9CA0
/* MaterialLayout.swift in Sources */
,
...
...
Source/BasicCardView.swift
deleted
100644 → 0
View file @
0bdc0c24
This diff is collapsed.
Click to expand it.
Source/
Image
CardView.swift
→
Source/CardView.swift
View file @
5bf2f0a9
...
...
@@ -18,7 +18,7 @@
import
UIKit
public
class
Image
CardView
:
MaterialPulseView
{
public
class
CardView
:
MaterialPulseView
{
//
// :name: dividerLayer
//
...
...
@@ -36,7 +36,7 @@ public class ImageCardView : MaterialPulseView {
/**
:name: divider
*/
public
var
divider
:
Bool
=
MaterialTheme
.
basicC
ardView
.
divider
{
public
var
divider
:
Bool
=
MaterialTheme
.
c
ardView
.
divider
{
didSet
{
reloadView
()
}
...
...
@@ -61,9 +61,9 @@ public class ImageCardView : MaterialPulseView {
}
}
/
/
//
:name: imageLayer
/
/
/
**
:name: imageLayer
*
/
public
private(set)
lazy
var
imageLayer
:
CAShapeLayer
=
CAShapeLayer
()
/**
...
...
@@ -326,12 +326,12 @@ public class ImageCardView : MaterialPulseView {
imageLayer
.
frame
.
size
.
width
=
bounds
.
size
.
width
// divider
if
true
==
divider
{
var
y
:
CGFloat
=
0
if
divider
{
var
y
:
CGFloat
=
contentInsetsRef
!.
bottom
+
dividerInsetsRef
!.
bottom
if
0
<
leftButtons
?
.
count
{
y
+=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!.
top
+
leftButtonsInsetsRef
!.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
leftButtonsInsetsRef
!.
top
+
leftButtonsInsetsRef
!.
bottom
+
leftButtons
!
[
0
]
.
frame
.
size
.
height
}
else
if
0
<
rightButtons
?
.
count
{
y
+=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!.
top
+
rightButtonsInsetsRef
!.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
y
+=
rightButtonsInsetsRef
!.
top
+
rightButtonsInsetsRef
!.
bottom
+
rightButtons
!
[
0
]
.
frame
.
size
.
height
}
if
0
<
y
{
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
...
...
@@ -347,29 +347,27 @@ public class ImageCardView : MaterialPulseView {
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
imageCardView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
imageCardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
imageCardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
imageCardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
imageCardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
imageCardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
imageCardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
imageCardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
imageCardView
.
dividerInsetsRef
contentsRect
=
MaterialTheme
.
imageCardView
.
contentsRect
contentsCenter
=
MaterialTheme
.
imageCardView
.
contentsCenter
contentsScale
=
MaterialTheme
.
imageCardView
.
contentsScale
contentsGravity
=
MaterialTheme
.
imageCardView
.
contentsGravity
shadowDepth
=
MaterialTheme
.
imageCardView
.
shadowDepth
shadowColor
=
MaterialTheme
.
imageCardView
.
shadowColor
zPosition
=
MaterialTheme
.
imageCardView
.
zPosition
masksToBounds
=
MaterialTheme
.
imageCardView
.
masksToBounds
cornerRadius
=
MaterialTheme
.
imageCardView
.
cornerRadius
borderWidth
=
MaterialTheme
.
imageCardView
.
borderWidth
borderColor
=
MaterialTheme
.
imageCardView
.
bordercolor
dividerColor
=
MaterialTheme
.
imageCardView
.
dividerColor
userInteractionEnabled
=
MaterialTheme
.
cardView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
cardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
cardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
cardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
cardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
cardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
cardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
cardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
cardView
.
dividerInsetsRef
contentsRect
=
MaterialTheme
.
cardView
.
contentsRect
contentsCenter
=
MaterialTheme
.
cardView
.
contentsCenter
contentsScale
=
MaterialTheme
.
cardView
.
contentsScale
contentsGravity
=
MaterialTheme
.
cardView
.
contentsGravity
shadowDepth
=
MaterialTheme
.
cardView
.
shadowDepth
shadowColor
=
MaterialTheme
.
cardView
.
shadowColor
zPosition
=
MaterialTheme
.
cardView
.
zPosition
borderWidth
=
MaterialTheme
.
cardView
.
borderWidth
borderColor
=
MaterialTheme
.
cardView
.
bordercolor
dividerColor
=
MaterialTheme
.
cardView
.
dividerColor
}
/**
...
...
@@ -496,18 +494,18 @@ public class ImageCardView : MaterialPulseView {
if
nil
!=
detailLabel
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!.
bottom
:
0
)
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!.
bottom
:
0
)
}
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
titleLabelInsetsRef
!.
bottom
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!.
bottom
:
0
)
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!.
bottom
:
0
)
}
}
else
if
nil
!=
metrics
[
"insetC"
]
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
!.
top
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
!.
top
+
(
divider
?
dividerInsetsRef
!.
top
+
dividerInsetsRef
!.
bottom
:
0
)
}
if
0
<
views
.
count
{
...
...
@@ -532,11 +530,11 @@ public class ImageCardView : MaterialPulseView {
internal
func
prepareDivider
(
y
:
CGFloat
,
width
:
CGFloat
)
{
if
nil
==
dividerLayer
{
dividerLayer
=
CAShapeLayer
()
dividerLayer
!.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
!.
frame
=
CGRectMake
(
0
,
y
,
width
,
1
)
dividerLayer
!.
zPosition
=
0
layer
.
addSublayer
(
dividerLayer
!
)
}
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
dividerLayer
?
.
frame
=
CGRectMake
(
dividerInsetsRef
!.
left
,
y
,
width
-
dividerInsetsRef
!.
left
-
dividerInsetsRef
!.
right
,
1
)
}
//
...
...
Source/FabButton.swift
View file @
5bf2f0a9
...
...
@@ -35,8 +35,6 @@ public class FabButton : MaterialButton {
shadowDepth
=
MaterialTheme
.
fabButton
.
shadowDepth
shadowColor
=
MaterialTheme
.
fabButton
.
shadowColor
zPosition
=
MaterialTheme
.
fabButton
.
zPosition
masksToBounds
=
MaterialTheme
.
fabButton
.
masksToBounds
cornerRadius
=
MaterialTheme
.
fabButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
fabButton
.
borderWidth
borderColor
=
MaterialTheme
.
fabButton
.
bordercolor
contentInsets
=
MaterialTheme
.
fabButton
.
contentInsets
...
...
Source/FlatButton.swift
View file @
5bf2f0a9
...
...
@@ -35,7 +35,6 @@ public class FlatButton : MaterialButton {
shadowDepth
=
MaterialTheme
.
flatButton
.
shadowDepth
shadowColor
=
MaterialTheme
.
flatButton
.
shadowColor
zPosition
=
MaterialTheme
.
flatButton
.
zPosition
masksToBounds
=
MaterialTheme
.
flatButton
.
masksToBounds
cornerRadius
=
MaterialTheme
.
flatButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
flatButton
.
borderWidth
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
...
...
Source/MaterialCollectionViewCell.swift
View file @
5bf2f0a9
...
...
@@ -452,7 +452,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni
shadowDepth
=
MaterialTheme
.
flatButton
.
shadowDepth
shadowColor
=
MaterialTheme
.
flatButton
.
shadowColor
zPosition
=
MaterialTheme
.
flatButton
.
zPosition
masksToBounds
=
MaterialTheme
.
flatButton
.
masksToBounds
cornerRadius
=
MaterialTheme
.
flatButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
flatButton
.
borderWidth
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
...
...
Source/MaterialLayer.swift
View file @
5bf2f0a9
...
...
@@ -158,11 +158,7 @@ public class MaterialLayer : CAShapeLayer {
:name: cornerRadius
*/
public
override
var
cornerRadius
:
CGFloat
{
get
{
return
visualLayer
.
cornerRadius
}
set
(
value
)
{
visualLayer
.
cornerRadius
=
value
didSet
{
if
.
Circle
==
shape
{
shape
=
.
None
}
...
...
@@ -224,10 +220,8 @@ public class MaterialLayer : CAShapeLayer {
public
override
func
layoutSublayers
()
{
super
.
layoutSublayers
()
visualLayer
.
frame
=
bounds
visualLayer
.
masksToBounds
=
true
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
prepareShape
()
prepareVisualLayer
()
}
/**
...
...
@@ -236,7 +230,7 @@ public class MaterialLayer : CAShapeLayer {
public
func
animation
(
animation
:
CAAnimation
)
{
animation
.
delegate
=
self
if
let
a
:
CABasicAnimation
=
animation
as?
CABasicAnimation
{
a
.
fromValue
=
valueForKeyPath
(
a
.
keyPath
!
)
//(nil == presentationLayer() ? self : presentationLayer() as! CALayer).valueForKeyPath(a.keyPath!)
a
.
fromValue
=
valueForKeyPath
(
a
.
keyPath
!
)
}
if
let
a
:
CAPropertyAnimation
=
animation
as?
CAPropertyAnimation
{
addAnimation
(
a
,
forKey
:
a
.
keyPath
!
)
...
...
@@ -271,6 +265,7 @@ public class MaterialLayer : CAShapeLayer {
animationDidStop
(
x
,
finished
:
true
)
}
}
prepareVisualLayer
()
}
/**
...
...
@@ -278,7 +273,7 @@ public class MaterialLayer : CAShapeLayer {
*/
public
func
prepareLayer
()
{
// visualLayer
masksToBounds
=
true
visualLayer
.
masksToBounds
=
true
visualLayer
.
zPosition
=
-
1
addSublayer
(
visualLayer
)
}
...
...
@@ -291,4 +286,13 @@ public class MaterialLayer : CAShapeLayer {
cornerRadius
=
width
/
2
}
}
//
// :name: prepareVisualLayer
//
internal
func
prepareVisualLayer
()
{
visualLayer
.
frame
=
bounds
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
visualLayer
.
cornerRadius
=
cornerRadius
}
}
Source/MaterialPulseView.swift
View file @
5bf2f0a9
...
...
@@ -153,8 +153,6 @@ public class MaterialPulseView : MaterialView {
shadowDepth
=
MaterialTheme
.
pulseView
.
shadowDepth
shadowColor
=
MaterialTheme
.
pulseView
.
shadowColor
zPosition
=
MaterialTheme
.
pulseView
.
zPosition
masksToBounds
=
MaterialTheme
.
pulseView
.
masksToBounds
cornerRadius
=
MaterialTheme
.
pulseView
.
cornerRadius
borderWidth
=
MaterialTheme
.
pulseView
.
borderWidth
borderColor
=
MaterialTheme
.
pulseView
.
bordercolor
...
...
Source/MaterialTheme.swift
View file @
5bf2f0a9
...
...
@@ -21,8 +21,7 @@ import UIKit
public
struct
MaterialTheme
{
public
struct
view
{}
public
struct
pulseView
{}
public
struct
basicCardView
{}
public
struct
imageCardView
{}
public
struct
cardView
{}
public
struct
navigationBarView
{}
public
struct
textLayer
{}
public
struct
label
{}
...
...
@@ -37,10 +36,6 @@ public extension MaterialTheme.view {
public
static
var
shadowDepth
:
MaterialDepth
=
.
None
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
...
...
@@ -67,10 +62,6 @@ public extension MaterialTheme.pulseView {
public
static
var
shadowDepth
:
MaterialDepth
=
.
None
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
...
...
@@ -93,63 +84,19 @@ public extension MaterialTheme.pulseView {
public
static
var
zPosition
:
CGFloat
=
0
}
// basicCardView
public
extension
MaterialTheme
.
basicCardView
{
// shadow
public
static
var
shadowDepth
:
MaterialDepth
=
.
Depth2
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
public
static
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
titleLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
detailLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
leftButtonsInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
public
static
var
rightButtonsInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
public
static
var
dividerInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten4
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
// image
public
static
var
contentsRect
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
var
contentsCenter
:
CGRect
=
CGRectMake
(
0
,
0
,
1
,
1
)
public
static
var
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
public
static
var
contentsGravity
:
MaterialGravity
=
.
ResizeAspectFill
// position
public
static
var
zPosition
:
CGFloat
=
0
// divider
public
static
var
divider
:
Bool
=
true
public
static
var
dividerColor
:
UIColor
=
MaterialColor
.
blueGrey
.
lighten5
}
// imageCardView
public
extension
MaterialTheme
.
imageCardView
{
// cardView
public
extension
MaterialTheme
.
cardView
{
// shadow
public
static
var
shadowDepth
:
MaterialDepth
=
.
Depth2
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
public
static
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
titleLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
detailLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
leftButtonsInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
public
static
var
rightButtonsInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
public
static
var
dividerInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
public
static
var
dividerInsetsRef
:
MaterialInsetsType
=
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
...
...
@@ -190,8 +137,6 @@ public extension MaterialTheme.navigationBarView {
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
public
static
var
contentInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
Square2
)
public
static
var
titleLabelInsetsRef
:
MaterialInsetsType
=
(
top
:
20
,
left
:
0
,
bottom
:
0
,
right
:
0
)
public
static
var
detailLabelInsetsRef
:
MaterialInsetsType
=
MaterialInsetsToValue
(
.
None
)
...
...
@@ -255,7 +200,6 @@ public extension MaterialTheme.flatButton {
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
Radius1
public
static
var
contentInsets
:
MaterialInsets
=
.
Rectangle3
public
static
var
shape
:
MaterialShape
=
.
None
...
...
@@ -287,7 +231,6 @@ public extension MaterialTheme.raisedButton {
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
Radius1
public
static
var
contentInsets
:
MaterialInsets
=
.
Rectangle2
public
static
var
shape
:
MaterialShape
=
.
None
...
...
@@ -320,8 +263,6 @@ public extension MaterialTheme.fabButton {
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
masksToBounds
:
Bool
=
false
public
static
var
cornerRadius
:
MaterialRadius
=
.
None
public
static
var
contentInsets
:
MaterialInsets
=
.
None
public
static
var
shape
:
MaterialShape
=
.
Circle
...
...
Source/MaterialView.swift
View file @
5bf2f0a9
...
...
@@ -210,7 +210,7 @@ public class MaterialView : UIView {
/**
:name: cornerRadius
*/
public
var
cornerRadius
:
MaterialRadius
?
{
public
var
cornerRadius
:
MaterialRadius
{
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadius
{
layer
.
cornerRadius
=
MaterialRadiusToValue
(
v
)
...
...
@@ -289,6 +289,7 @@ public class MaterialView : UIView {
borderWidth
=
MaterialTheme
.
view
.
borderWidth
shadowDepth
=
.
None
shape
=
.
None
cornerRadius
=
.
None
super
.
init
(
coder
:
aDecoder
)
}
...
...
@@ -303,6 +304,7 @@ public class MaterialView : UIView {
borderWidth
=
MaterialTheme
.
view
.
borderWidth
shadowDepth
=
.
None
shape
=
.
None
cornerRadius
=
.
None
super
.
init
(
frame
:
frame
)
prepareView
()
}
...
...
@@ -315,15 +317,14 @@ public class MaterialView : UIView {
}
/**
:name: layoutSub
views
:name: layoutSub
layersOfLayer
*/
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
prepareShape
()
visualLayer
.
frame
=
bounds
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
prepareVisualLayer
()
}
}
/**
...
...
@@ -374,6 +375,7 @@ public class MaterialView : UIView {
animationDidStop
(
x
,
finished
:
true
)
}
}
prepareVisualLayer
()
}
//
...
...
@@ -386,8 +388,6 @@ public class MaterialView : UIView {
shadowDepth
=
MaterialTheme
.
view
.
shadowDepth
shadowColor
=
MaterialTheme
.
view
.
shadowColor
zPosition
=
MaterialTheme
.
view
.
zPosition
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
cornerRadius
=
MaterialTheme
.
view
.
cornerRadius
borderColor
=
MaterialTheme
.
view
.
bordercolor
// visualLayer
...
...
@@ -404,4 +404,13 @@ public class MaterialView : UIView {
layer
.
cornerRadius
=
width
/
2
}
}
//
// :name: prepareVisualLayer
//
internal
func
prepareVisualLayer
()
{
visualLayer
.
frame
=
bounds
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
}
}
Source/NavigationBarView.swift
View file @
5bf2f0a9
...
...
@@ -220,8 +220,6 @@ public class NavigationBarView : MaterialView {
shadowDepth
=
MaterialTheme
.
navigationBarView
.
shadowDepth
shadowColor
=
MaterialTheme
.
navigationBarView
.
shadowColor
zPosition
=
MaterialTheme
.
navigationBarView
.
zPosition
masksToBounds
=
MaterialTheme
.
navigationBarView
.
masksToBounds
cornerRadius
=
MaterialTheme
.
navigationBarView
.
cornerRadius
borderWidth
=
MaterialTheme
.
navigationBarView
.
borderWidth
borderColor
=
MaterialTheme
.
navigationBarView
.
bordercolor
}
...
...
Source/RaisedButton.swift
View file @
5bf2f0a9
...
...
@@ -35,7 +35,6 @@ public class RaisedButton : MaterialButton {
shadowDepth
=
MaterialTheme
.
raisedButton
.
shadowDepth
shadowColor
=
MaterialTheme
.
raisedButton
.
shadowColor
zPosition
=
MaterialTheme
.
raisedButton
.
zPosition
masksToBounds
=
MaterialTheme
.
raisedButton
.
masksToBounds
cornerRadius
=
MaterialTheme
.
raisedButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
raisedButton
.
borderWidth
borderColor
=
MaterialTheme
.
raisedButton
.
bordercolor
...
...
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