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
367592c3
Commit
367592c3
authored
Sep 27, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added MaterialShape
parent
4e64b67f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
114 additions
and
61 deletions
+114
-61
MaterialKit.xcodeproj/project.pbxproj
+4
-0
Source/FlatButton.swift
+7
-5
Source/MaterialButton.swift
+34
-24
Source/MaterialRadius.swift
+2
-3
Source/MaterialShape.swift
+22
-0
Source/MaterialTheme.swift
+5
-1
Source/MaterialView.swift
+37
-26
Source/NavigationBarView.swift
+3
-2
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
367592c3
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
65BDD1671BB7111E006F7F2B
/* MaterialButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1561BB6FC82006F7F2B
/* MaterialButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
65BDD1671BB7111E006F7F2B
/* MaterialButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1561BB6FC82006F7F2B
/* MaterialButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
65BDD1681BB7111E006F7F2B
/* FlatButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1581BB6FE3E006F7F2B
/* FlatButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
65BDD1681BB7111E006F7F2B
/* FlatButton.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1581BB6FE3E006F7F2B
/* FlatButton.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16C1BB88D1A006F7F2B
/* MaterialShape.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
...
@@ -65,6 +66,7 @@
...
@@ -65,6 +66,7 @@
65BDD15A1BB7095E006F7F2B
/* MaterialRadius.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialRadius.swift
;
sourceTree
=
"<group>"
;
};
65BDD15A1BB7095E006F7F2B
/* MaterialRadius.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialRadius.swift
;
sourceTree
=
"<group>"
;
};
65BDD15C1BB70D60006F7F2B
/* MaterialInsets.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialInsets.swift
;
sourceTree
=
"<group>"
;
};
65BDD15C1BB70D60006F7F2B
/* MaterialInsets.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialInsets.swift
;
sourceTree
=
"<group>"
;
};
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialBorder.swift
;
sourceTree
=
"<group>"
;
};
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialBorder.swift
;
sourceTree
=
"<group>"
;
};
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialShape.swift
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -195,6 +197,7 @@
...
@@ -195,6 +197,7 @@
65BDD15A1BB7095E006F7F2B
/* MaterialRadius.swift */
,
65BDD15A1BB7095E006F7F2B
/* MaterialRadius.swift */
,
65BDD15C1BB70D60006F7F2B
/* MaterialInsets.swift */
,
65BDD15C1BB70D60006F7F2B
/* MaterialInsets.swift */
,
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
,
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
,
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
,
);
);
name
=
Theme
;
name
=
Theme
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -336,6 +339,7 @@
...
@@ -336,6 +339,7 @@
files
=
(
files
=
(
65BDD15D1BB70D60006F7F2B
/* MaterialInsets.swift in Sources */
,
65BDD15D1BB70D60006F7F2B
/* MaterialInsets.swift in Sources */
,
65BDD1471BB5B916006F7F2B
/* MaterialView.swift in Sources */
,
65BDD1471BB5B916006F7F2B
/* MaterialView.swift in Sources */
,
65BDD16C1BB88D1A006F7F2B
/* MaterialShape.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1521BB6EE7C006F7F2B
/* RobotoFont.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
65BDD1591BB6FE3E006F7F2B
/* FlatButton.swift in Sources */
,
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
,
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
,
...
...
Source/FlatButton.swift
View file @
367592c3
...
@@ -26,11 +26,6 @@ public class FlatButton : MaterialButton {
...
@@ -26,11 +26,6 @@ public class FlatButton : MaterialButton {
super
.
prepareView
()
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
button
.
flat
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
button
.
flat
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
titleLabel
!.
font
=
MaterialTheme
.
button
.
flat
.
titleLabelFont
titleLabel
!.
font
=
MaterialTheme
.
button
.
flat
.
titleLabelFont
backgroundColor
=
MaterialColor
.
red
.
base
//MaterialTheme.button.flat.backgroudColor
cornerRadius
=
MaterialTheme
.
button
.
flat
.
cornerRadius
contentInsets
=
MaterialTheme
.
button
.
flat
.
contentInsets
borderWidth
=
MaterialTheme
.
button
.
flat
.
borderWidth
borderColor
=
MaterialTheme
.
button
.
flat
.
bordercolor
}
}
//
//
...
@@ -42,5 +37,11 @@ public class FlatButton : MaterialButton {
...
@@ -42,5 +37,11 @@ public class FlatButton : MaterialButton {
shadowColor
=
MaterialTheme
.
button
.
flat
.
shadowColor
shadowColor
=
MaterialTheme
.
button
.
flat
.
shadowColor
zPosition
=
MaterialTheme
.
button
.
flat
.
zPosition
zPosition
=
MaterialTheme
.
button
.
flat
.
zPosition
masksToBounds
=
MaterialTheme
.
button
.
flat
.
masksToBounds
masksToBounds
=
MaterialTheme
.
button
.
flat
.
masksToBounds
shape
=
MaterialTheme
.
button
.
flat
.
shape
cornerRadius
=
MaterialTheme
.
button
.
flat
.
cornerRadius
borderWidth
=
MaterialTheme
.
button
.
flat
.
borderWidth
borderColor
=
MaterialTheme
.
button
.
flat
.
bordercolor
contentInsets
=
MaterialTheme
.
button
.
flat
.
contentInsets
backgroundColor
=
MaterialTheme
.
button
.
flat
.
backgroudColor
}
}
}
}
\ No newline at end of file
Source/MaterialButton.swift
View file @
367592c3
...
@@ -35,8 +35,11 @@ public class MaterialButton : UIButton {
...
@@ -35,8 +35,11 @@ public class MaterialButton : UIButton {
:name: x
:name: x
*/
*/
public
var
x
:
CGFloat
!
{
public
var
x
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
origin
.
x
=
x
return
layer
.
bounds
.
origin
.
x
}
set
(
value
)
{
layer
.
bounds
.
origin
.
x
=
value
}
}
}
}
...
@@ -44,8 +47,11 @@ public class MaterialButton : UIButton {
...
@@ -44,8 +47,11 @@ public class MaterialButton : UIButton {
:name: y
:name: y
*/
*/
public
var
y
:
CGFloat
!
{
public
var
y
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
origin
.
y
=
y
return
layer
.
bounds
.
origin
.
y
}
set
(
value
)
{
layer
.
bounds
.
origin
.
y
=
value
}
}
}
}
...
@@ -53,8 +59,11 @@ public class MaterialButton : UIButton {
...
@@ -53,8 +59,11 @@ public class MaterialButton : UIButton {
:name: width
:name: width
*/
*/
public
var
width
:
CGFloat
!
{
public
var
width
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
size
.
width
=
width
return
layer
.
bounds
.
size
.
width
}
set
(
value
)
{
layer
.
bounds
.
size
.
width
=
value
}
}
}
}
...
@@ -62,8 +71,11 @@ public class MaterialButton : UIButton {
...
@@ -62,8 +71,11 @@ public class MaterialButton : UIButton {
:name: height
:name: height
*/
*/
public
var
height
:
CGFloat
!
{
public
var
height
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
size
.
height
=
height
return
layer
.
bounds
.
size
.
height
}
set
(
value
)
{
layer
.
bounds
.
size
.
height
=
value
}
}
}
}
...
@@ -117,11 +129,20 @@ public class MaterialButton : UIButton {
...
@@ -117,11 +129,20 @@ public class MaterialButton : UIButton {
*/
*/
public
var
cornerRadius
:
MaterialRadius
!
{
public
var
cornerRadius
:
MaterialRadius
!
{
didSet
{
didSet
{
switch
cornerRadius
!
{
case
.
Square
,
.
Light
,
.
Regular
,
.
Medium
,
.
Heavy
:
layer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
layer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
case
.
Round
:
}
layer
.
cornerRadius
=
bounds
.
width
/
2
}
/**
:name: shape
*/
public
var
shape
:
MaterialShape
!
{
didSet
{
switch
shape
!
{
case
.
Square
:
layer
.
cornerRadius
=
0
case
.
Circle
:
layer
.
cornerRadius
=
width
/
2
}
}
}
}
}
}
...
@@ -194,11 +215,10 @@ public class MaterialButton : UIButton {
...
@@ -194,11 +215,10 @@ public class MaterialButton : UIButton {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
prepareView
()
prepareView
()
prepareLayer
()
prepareLayer
()
prepareBounds
()
}
}
public
convenience
init
()
{
public
convenience
init
()
{
self
.
init
(
frame
:
CGRect
Make
(
0
,
0
,
100
,
100
)
)
self
.
init
(
frame
:
CGRect
Zero
)
}
}
/**
/**
...
@@ -230,16 +250,6 @@ public class MaterialButton : UIButton {
...
@@ -230,16 +250,6 @@ public class MaterialButton : UIButton {
}
}
//
//
// :name: prepareBounds
//
internal
func
prepareBounds
()
{
x
=
frame
.
origin
.
x
y
=
frame
.
origin
.
y
width
=
frame
.
size
.
width
height
=
frame
.
size
.
height
}
//
// :name: prepareLayer
// :name: prepareLayer
//
//
internal
func
prepareLayer
()
{
internal
func
prepareLayer
()
{
...
...
Source/MaterialRadius.swift
View file @
367592c3
...
@@ -21,12 +21,11 @@ import UIKit
...
@@ -21,12 +21,11 @@ import UIKit
public
typealias
MaterialRadiusType
=
CGFloat
public
typealias
MaterialRadiusType
=
CGFloat
public
enum
MaterialRadius
{
public
enum
MaterialRadius
{
case
Squar
e
case
Non
e
case
Light
case
Light
case
Regular
case
Regular
case
Medium
case
Medium
case
Heavy
case
Heavy
case
Round
}
}
/**
/**
...
@@ -34,7 +33,7 @@ public enum MaterialRadius {
...
@@ -34,7 +33,7 @@ public enum MaterialRadius {
*/
*/
public
func
MaterialRadiusToValue
(
radius
:
MaterialRadius
)
->
MaterialRadiusType
{
public
func
MaterialRadiusToValue
(
radius
:
MaterialRadius
)
->
MaterialRadiusType
{
switch
radius
{
switch
radius
{
case
.
Square
,
.
Round
:
case
.
None
:
return
0
return
0
case
.
Light
:
case
.
Light
:
return
4
return
4
...
...
Source/MaterialShape.swift
0 → 100644
View file @
367592c3
//
// 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/>.
//
public
enum
MaterialShape
{
case
Square
case
Circle
}
Source/MaterialTheme.swift
View file @
367592c3
...
@@ -42,7 +42,8 @@ public extension MaterialTheme.view {
...
@@ -42,7 +42,8 @@ public extension MaterialTheme.view {
// shape
// shape
public
static
let
masksToBounds
:
Bool
=
false
public
static
let
masksToBounds
:
Bool
=
false
public
static
let
cornerRadius
:
MaterialRadius
=
.
Square
public
static
let
cornerRadius
:
MaterialRadius
=
.
None
public
static
let
shape
:
MaterialShape
=
.
Square
// border
// border
public
static
let
borderWidth
:
MaterialBorder
=
.
None
public
static
let
borderWidth
:
MaterialBorder
=
.
None
...
@@ -79,6 +80,7 @@ public extension MaterialTheme.navigation {
...
@@ -79,6 +80,7 @@ public extension MaterialTheme.navigation {
// shape
// shape
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
public
static
let
cornerRadius
:
MaterialRadius
=
MaterialTheme
.
view
.
cornerRadius
public
static
let
cornerRadius
:
MaterialRadius
=
MaterialTheme
.
view
.
cornerRadius
public
static
let
shape
:
MaterialShape
=
MaterialTheme
.
view
.
shape
// border
// border
public
static
let
borderWidth
:
MaterialBorder
=
MaterialTheme
.
view
.
borderWidth
public
static
let
borderWidth
:
MaterialBorder
=
MaterialTheme
.
view
.
borderWidth
...
@@ -110,6 +112,7 @@ public extension MaterialTheme.button {
...
@@ -110,6 +112,7 @@ public extension MaterialTheme.button {
// shape
// shape
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
view
.
masksToBounds
public
static
let
cornerRadius
:
MaterialRadius
=
.
Light
public
static
let
cornerRadius
:
MaterialRadius
=
.
Light
public
static
let
shape
:
MaterialShape
=
MaterialTheme
.
view
.
shape
public
static
let
contentInsets
:
MaterialInsets
=
.
Inset2
public
static
let
contentInsets
:
MaterialInsets
=
.
Inset2
// border
// border
...
@@ -139,6 +142,7 @@ public extension MaterialTheme.button.flat {
...
@@ -139,6 +142,7 @@ public extension MaterialTheme.button.flat {
// shape
// shape
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
button
.
masksToBounds
public
static
let
masksToBounds
:
Bool
=
MaterialTheme
.
button
.
masksToBounds
public
static
let
cornerRadius
:
MaterialRadius
=
MaterialTheme
.
button
.
cornerRadius
public
static
let
cornerRadius
:
MaterialRadius
=
MaterialTheme
.
button
.
cornerRadius
public
static
let
shape
:
MaterialShape
=
MaterialTheme
.
button
.
shape
public
static
let
contentInsets
:
MaterialInsets
=
MaterialTheme
.
button
.
contentInsets
public
static
let
contentInsets
:
MaterialInsets
=
MaterialTheme
.
button
.
contentInsets
// border
// border
...
...
Source/MaterialView.swift
View file @
367592c3
...
@@ -80,8 +80,11 @@ public class MaterialView: UIView {
...
@@ -80,8 +80,11 @@ public class MaterialView: UIView {
:name: x
:name: x
*/
*/
public
var
x
:
CGFloat
!
{
public
var
x
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
origin
.
x
=
x
return
layer
.
bounds
.
origin
.
x
}
set
(
value
)
{
layer
.
bounds
.
origin
.
x
=
value
}
}
}
}
...
@@ -89,8 +92,11 @@ public class MaterialView: UIView {
...
@@ -89,8 +92,11 @@ public class MaterialView: UIView {
:name: y
:name: y
*/
*/
public
var
y
:
CGFloat
!
{
public
var
y
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
origin
.
y
=
y
return
layer
.
bounds
.
origin
.
y
}
set
(
value
)
{
layer
.
bounds
.
origin
.
y
=
value
}
}
}
}
...
@@ -98,8 +104,11 @@ public class MaterialView: UIView {
...
@@ -98,8 +104,11 @@ public class MaterialView: UIView {
:name: width
:name: width
*/
*/
public
var
width
:
CGFloat
!
{
public
var
width
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
size
.
width
=
width
return
layer
.
bounds
.
size
.
width
}
set
(
value
)
{
layer
.
bounds
.
size
.
width
=
value
}
}
}
}
...
@@ -107,8 +116,11 @@ public class MaterialView: UIView {
...
@@ -107,8 +116,11 @@ public class MaterialView: UIView {
:name: height
:name: height
*/
*/
public
var
height
:
CGFloat
!
{
public
var
height
:
CGFloat
!
{
didSet
{
get
{
layer
.
bounds
.
size
.
height
=
height
return
layer
.
bounds
.
size
.
height
}
set
(
value
)
{
layer
.
bounds
.
size
.
height
=
value
}
}
}
}
...
@@ -162,11 +174,20 @@ public class MaterialView: UIView {
...
@@ -162,11 +174,20 @@ public class MaterialView: UIView {
*/
*/
public
var
cornerRadius
:
MaterialRadius
!
{
public
var
cornerRadius
:
MaterialRadius
!
{
didSet
{
didSet
{
switch
cornerRadius
!
{
case
.
Square
,
.
Light
,
.
Regular
,
.
Medium
,
.
Heavy
:
layer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
layer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
case
.
Round
:
}
layer
.
cornerRadius
=
bounds
.
width
/
2
}
/**
:name: shape
*/
public
var
shape
:
MaterialShape
!
{
didSet
{
switch
shape
!
{
case
.
Square
:
layer
.
cornerRadius
=
0
case
.
Circle
:
layer
.
cornerRadius
=
width
/
2
}
}
}
}
}
}
...
@@ -176,7 +197,7 @@ public class MaterialView: UIView {
...
@@ -176,7 +197,7 @@ public class MaterialView: UIView {
*/
*/
public
var
borderWidth
:
MaterialBorder
!
{
public
var
borderWidth
:
MaterialBorder
!
{
didSet
{
didSet
{
layer
.
borderWidth
=
MaterialBorderToValue
(
borderWidth
)
layer
.
borderWidth
=
MaterialBorderToValue
(
borderWidth
!
)
}
}
}
}
...
@@ -194,7 +215,7 @@ public class MaterialView: UIView {
...
@@ -194,7 +215,7 @@ public class MaterialView: UIView {
*/
*/
public
var
shadowDepth
:
MaterialShadow
!
{
public
var
shadowDepth
:
MaterialShadow
!
{
didSet
{
didSet
{
let
value
:
MaterialShadowType
=
MaterialShadowToValue
(
shadowDepth
)
let
value
:
MaterialShadowType
=
MaterialShadowToValue
(
shadowDepth
!
)
shadowOffset
=
value
.
offset
shadowOffset
=
value
.
offset
shadowOpacity
=
value
.
opacity
shadowOpacity
=
value
.
opacity
shadowRadius
=
value
.
radius
shadowRadius
=
value
.
radius
...
@@ -224,7 +245,6 @@ public class MaterialView: UIView {
...
@@ -224,7 +245,6 @@ public class MaterialView: UIView {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
prepareView
()
prepareView
()
prepareLayer
()
prepareLayer
()
prepareBounds
()
}
}
/**
/**
...
@@ -243,16 +263,6 @@ public class MaterialView: UIView {
...
@@ -243,16 +263,6 @@ public class MaterialView: UIView {
}
}
//
//
// :name: prepareBounds
//
internal
func
prepareBounds
()
{
x
=
frame
.
origin
.
x
y
=
frame
.
origin
.
y
width
=
frame
.
size
.
width
height
=
frame
.
size
.
height
}
//
// :name: prepareLayer
// :name: prepareLayer
//
//
internal
func
prepareLayer
()
{
internal
func
prepareLayer
()
{
...
@@ -264,8 +274,9 @@ public class MaterialView: UIView {
...
@@ -264,8 +274,9 @@ public class MaterialView: UIView {
shadowColor
=
MaterialTheme
.
view
.
shadowColor
shadowColor
=
MaterialTheme
.
view
.
shadowColor
zPosition
=
MaterialTheme
.
view
.
zPosition
zPosition
=
MaterialTheme
.
view
.
zPosition
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
masksToBounds
=
MaterialTheme
.
view
.
masksToBounds
shape
=
MaterialTheme
.
view
.
shape
cornerRadius
=
MaterialTheme
.
view
.
cornerRadius
cornerRadius
=
MaterialTheme
.
view
.
cornerRadius
borderWidth
=
.
None
borderWidth
=
MaterialTheme
.
view
.
borderWidth
borderColor
=
MaterialTheme
.
view
.
bordercolor
borderColor
=
MaterialTheme
.
view
.
bordercolor
}
}
}
}
...
...
Source/NavigationBarView.swift
View file @
367592c3
...
@@ -58,8 +58,9 @@ public class NavigationBarView: MaterialView {
...
@@ -58,8 +58,9 @@ public class NavigationBarView: MaterialView {
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
shadowColor
=
MaterialTheme
.
navigation
.
shadowColor
zPosition
=
MaterialTheme
.
navigation
.
zPosition
zPosition
=
MaterialTheme
.
navigation
.
zPosition
masksToBounds
=
MaterialTheme
.
navigation
.
masksToBounds
masksToBounds
=
MaterialTheme
.
navigation
.
masksToBounds
shape
=
MaterialTheme
.
navigation
.
shape
cornerRadius
=
MaterialTheme
.
navigation
.
cornerRadius
cornerRadius
=
MaterialTheme
.
navigation
.
cornerRadius
borderWidth
=
.
None
borderWidth
=
MaterialTheme
.
navigation
.
borderWidth
borderColor
=
MaterialTheme
.
view
.
bordercolor
borderColor
=
MaterialTheme
.
navigation
.
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