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
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
79 additions
and
590 deletions
+79
-590
MaterialKit.xcodeproj/project.pbxproj
+6
-12
Source/BasicCardView.swift
+0
-448
Source/CardView.swift
+35
-37
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
+20
-11
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
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import
UIKit
public
class
BasicCardView
:
MaterialPulseView
{
//
// :name: dividerLayer
//
internal
var
dividerLayer
:
CAShapeLayer
?
//
// :name: dividerColor
//
public
var
dividerColor
:
UIColor
?
{
didSet
{
dividerLayer
?
.
backgroundColor
=
dividerColor
?
.
CGColor
}
}
/**
:name: divider
*/
public
var
divider
:
Bool
=
MaterialTheme
.
basicCardView
.
divider
{
didSet
{
reloadView
()
}
}
/**
:name: dividerInsets
*/
public
var
dividerInsets
:
MaterialInsets
?
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsets
?
nil
:
MaterialInsetsToValue
(
dividerInsets
!
)
}
}
/**
:name: dividerInsetsRef
*/
public
var
dividerInsetsRef
:
MaterialInsetsType
!
{
didSet
{
dividerInsetsRef
=
nil
==
dividerInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
dividerInsetsRef
!
reloadView
()
}
}
/**
:name: contentInsets
*/
public
var
contentInsets
:
MaterialInsets
?
{
didSet
{
contentInsetsRef
=
nil
==
contentInsets
?
nil
:
MaterialInsetsToValue
(
contentInsets
!
)
}
}
/**
:name: contentInsetsRef
*/
public
var
contentInsetsRef
:
MaterialInsetsType
!
{
didSet
{
contentInsetsRef
=
nil
==
contentInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
contentInsetsRef
!
reloadView
()
}
}
/**
:name: titleLabelInsets
*/
public
var
titleLabelInsets
:
MaterialInsets
?
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsets
?
nil
:
MaterialInsetsToValue
(
titleLabelInsets
!
)
}
}
/**
:name: titleLabelInsetsRef
*/
public
var
titleLabelInsetsRef
:
MaterialInsetsType
!
{
didSet
{
titleLabelInsetsRef
=
nil
==
titleLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
titleLabelInsetsRef
!
reloadView
()
}
}
/**
:name: titleLabel
*/
public
var
titleLabel
:
UILabel
?
{
didSet
{
titleLabel
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
}
}
/**
:name: detailLabelInsets
*/
public
var
detailLabelInsets
:
MaterialInsets
?
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsets
?
nil
:
MaterialInsetsToValue
(
detailLabelInsets
!
)
}
}
/**
:name: detailLabelInsetsRef
*/
public
var
detailLabelInsetsRef
:
MaterialInsetsType
!
{
didSet
{
detailLabelInsetsRef
=
nil
==
detailLabelInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
detailLabelInsetsRef
!
reloadView
()
}
}
/**
:name: detailLabel
*/
public
var
detailLabel
:
UILabel
?
{
didSet
{
detailLabel
?
.
translatesAutoresizingMaskIntoConstraints
=
false
reloadView
()
}
}
/**
:name: leftButtonsInsets
*/
public
var
leftButtonsInsets
:
MaterialInsets
?
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsets
?
nil
:
MaterialInsetsToValue
(
leftButtonsInsets
!
)
}
}
/**
:name: leftButtonsInsetsRef
*/
public
var
leftButtonsInsetsRef
:
MaterialInsetsType
!
{
didSet
{
leftButtonsInsetsRef
=
nil
==
leftButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
leftButtonsInsetsRef
!
reloadView
()
}
}
/**
:name: leftButtons
*/
public
var
leftButtons
:
Array
<
UIButton
>
?
{
didSet
{
if
let
v
=
leftButtons
{
for
b
in
v
{
b
.
translatesAutoresizingMaskIntoConstraints
=
false
}
}
reloadView
()
}
}
/**
:name: rightButtonsInsets
*/
public
var
rightButtonsInsets
:
MaterialInsets
?
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsets
?
nil
:
MaterialInsetsToValue
(
rightButtonsInsets
!
)
}
}
/**
:name: rightButtonsInsetsRef
*/
public
var
rightButtonsInsetsRef
:
MaterialInsetsType
!
{
didSet
{
rightButtonsInsetsRef
=
nil
==
rightButtonsInsetsRef
?
MaterialInsetsToValue
(
.
None
)
:
rightButtonsInsetsRef
!
reloadView
()
}
}
/**
:name: rightButtons
*/
public
var
rightButtons
:
Array
<
UIButton
>
?
{
didSet
{
if
let
v
=
rightButtons
{
for
b
in
v
{
b
.
translatesAutoresizingMaskIntoConstraints
=
false
}
}
reloadView
()
}
}
/**
:name: init
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
/**
:name: init
*/
public
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
}
/**
:name: init
*/
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectNull
)
}
/**
:name: init
*/
public
convenience
init
?(
titleLabel
:
UILabel
?
=
nil
,
detailLabel
:
UILabel
?
=
nil
,
leftButtons
:
Array
<
UIButton
>
?
=
nil
,
rightButtons
:
Array
<
UIButton
>
?
=
nil
)
{
self
.
init
(
frame
:
CGRectNull
)
prepareProperties
(
titleLabel
,
detailLabel
:
detailLabel
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
/**
:name: layoutSubviews
*/
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
// divider
if
true
==
divider
{
var
y
:
CGFloat
=
0
if
0
<
leftButtons
?
.
count
{
y
+=
contentInsetsRef
!.
bottom
+
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
}
if
0
<
y
{
prepareDivider
(
bounds
.
size
.
height
-
y
-
0.5
,
width
:
bounds
.
size
.
width
)
}
}
else
{
dividerLayer
?
.
removeFromSuperlayer
()
dividerLayer
=
nil
}
}
/**
:name: prepareView
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
userInteractionEnabled
=
MaterialTheme
.
basicCardView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
basicCardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
basicCardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
basicCardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
basicCardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
basicCardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
basicCardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
basicCardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
basicCardView
.
dividerInsetsRef
contentsRect
=
MaterialTheme
.
basicCardView
.
contentsRect
contentsCenter
=
MaterialTheme
.
basicCardView
.
contentsCenter
contentsScale
=
MaterialTheme
.
basicCardView
.
contentsScale
contentsGravity
=
MaterialTheme
.
basicCardView
.
contentsGravity
shadowDepth
=
MaterialTheme
.
basicCardView
.
shadowDepth
shadowColor
=
MaterialTheme
.
basicCardView
.
shadowColor
zPosition
=
MaterialTheme
.
basicCardView
.
zPosition
masksToBounds
=
MaterialTheme
.
basicCardView
.
masksToBounds
cornerRadius
=
MaterialTheme
.
basicCardView
.
cornerRadius
borderWidth
=
MaterialTheme
.
basicCardView
.
borderWidth
borderColor
=
MaterialTheme
.
basicCardView
.
bordercolor
dividerColor
=
MaterialTheme
.
basicCardView
.
dividerColor
}
/**
:name: reloadView
*/
public
func
reloadView
()
{
// clear constraints so new ones do not conflict
removeConstraints
(
constraints
)
for
v
in
subviews
{
v
.
removeFromSuperview
()
}
var
verticalFormat
:
String
=
"V:|"
var
views
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
metrics
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
titleLabelInsetsRef
!.
top
}
else
if
nil
!=
detailLabel
{
verticalFormat
+=
"-(insetTop)"
metrics
[
"insetTop"
]
=
contentInsetsRef
!.
top
+
detailLabelInsetsRef
!.
top
}
// title
if
let
v
=
titleLabel
{
addSubview
(
v
)
verticalFormat
+=
"-[titleLabel]"
views
[
"titleLabel"
]
=
v
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
titleLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
titleLabelInsetsRef
!.
right
)
}
// detail
if
let
v
=
detailLabel
{
addSubview
(
v
)
if
nil
!=
titleLabel
{
verticalFormat
+=
"-(insetB)"
metrics
[
"insetB"
]
=
titleLabelInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
top
}
verticalFormat
+=
"-[detailLabel]"
views
[
"detailLabel"
]
=
v
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
contentInsetsRef
!.
left
+
detailLabelInsetsRef
!.
left
,
right
:
contentInsetsRef
!.
right
+
detailLabelInsetsRef
!.
right
)
}
// leftButtons
if
let
v
=
leftButtons
{
if
0
<
v
.
count
{
var
h
:
String
=
"H:|"
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
0
for
b
in
v
{
let
k
:
String
=
"b
\(
i
)
"
d
[
k
]
=
b
if
0
==
i
++
{
h
+=
"-(left)-"
}
else
{
h
+=
"-(left_right)-"
}
h
+=
"[
\(
k
)
]"
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!.
bottom
)
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
contentInsetsRef
!.
left
+
leftButtonsInsetsRef
!.
left
,
"left_right"
:
leftButtonsInsetsRef
!.
left
+
leftButtonsInsetsRef
!.
right
],
views
:
d
))
}
}
// rightButtons
if
let
v
=
rightButtons
{
if
0
<
v
.
count
{
var
h
:
String
=
"H:"
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
v
.
count
-
1
for
b
in
v
{
let
k
:
String
=
"b
\(
i
)
"
d
[
k
]
=
b
h
+=
"[
\(
k
)
]"
if
0
==
i
--
{
h
+=
"-(right)-"
}
else
{
h
+=
"-(right_left)-"
}
addSubview
(
b
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!.
bottom
)
}
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
contentInsetsRef
!.
right
+
rightButtonsInsetsRef
!.
right
,
"right_left"
:
rightButtonsInsetsRef
!.
right
+
rightButtonsInsetsRef
!.
left
],
views
:
d
))
}
}
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
leftButtons
!
[
0
]
metrics
[
"insetC"
]
=
leftButtonsInsetsRef
!.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
leftButtonsInsetsRef
!.
bottom
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-(insetC)-[button]"
views
[
"button"
]
=
rightButtons
!
[
0
]
metrics
[
"insetC"
]
=
rightButtonsInsetsRef
!.
top
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
rightButtonsInsetsRef
!.
bottom
}
if
nil
!=
detailLabel
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
detailLabelInsetsRef
!.
bottom
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
detailLabelInsetsRef
!.
bottom
}
}
else
if
nil
!=
titleLabel
{
if
nil
==
metrics
[
"insetC"
]
{
metrics
[
"insetBottom"
]
=
contentInsetsRef
!.
bottom
+
titleLabelInsetsRef
!.
bottom
}
else
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
}
}
else
if
nil
!=
metrics
[
"insetC"
]
{
metrics
[
"insetC"
]
=
(
metrics
[
"insetC"
]
as!
CGFloat
)
+
contentInsetsRef
!.
top
}
if
0
<
views
.
count
{
verticalFormat
+=
"-(insetBottom)-|"
print
(
verticalFormat
)
addConstraints
(
MaterialLayout
.
constraint
(
verticalFormat
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
}
}
//
// :name: prepareDivider
//
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
!
)
}
}
//
// :name: prepareProperties
//
internal
func
prepareProperties
(
titleLabel
:
UILabel
?,
detailLabel
:
UILabel
?,
leftButtons
:
Array
<
UIButton
>
?,
rightButtons
:
Array
<
UIButton
>
?)
{
self
.
titleLabel
=
titleLabel
self
.
detailLabel
=
detailLabel
self
.
leftButtons
=
leftButtons
self
.
rightButtons
=
rightButtons
}
}
\ No newline at end of file
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
.
imageC
ardView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
imageC
ardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
imageC
ardView
.
pulseColor
userInteractionEnabled
=
MaterialTheme
.
c
ardView
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
c
ardView
.
backgroundColor
pulseColor
=
MaterialTheme
.
c
ardView
.
pulseColor
contentInsetsRef
=
MaterialTheme
.
imageC
ardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
imageC
ardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
imageC
ardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
imageC
ardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
imageC
ardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
imageC
ardView
.
dividerInsetsRef
contentInsetsRef
=
MaterialTheme
.
c
ardView
.
contentInsetsRef
titleLabelInsetsRef
=
MaterialTheme
.
c
ardView
.
titleLabelInsetsRef
detailLabelInsetsRef
=
MaterialTheme
.
c
ardView
.
detailLabelInsetsRef
leftButtonsInsetsRef
=
MaterialTheme
.
c
ardView
.
leftButtonsInsetsRef
rightButtonsInsetsRef
=
MaterialTheme
.
c
ardView
.
rightButtonsInsetsRef
dividerInsetsRef
=
MaterialTheme
.
c
ardView
.
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
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
()
prepareShape
()
visualLayer
.
frame
=
bounds
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
public
override
func
layoutSublayersOfLayer
(
layer
:
CALayer
)
{
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
prepareShape
()
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