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
f1faab07
Commit
f1faab07
authored
Feb 27, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit for shadowPath fix
parent
6d13b647
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
168 additions
and
70 deletions
+168
-70
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
+6
-0
Sources/MaterialButton.swift
+26
-11
Sources/MaterialCollectionViewCell.swift
+32
-12
Sources/MaterialLayer.swift
+0
-3
Sources/MaterialTableViewCell.swift
+23
-8
Sources/MaterialView.swift
+26
-11
Sources/SideNavigationViewController.swift
+2
-2
Sources/TextField.swift
+27
-12
Sources/TextView.swift
+26
-11
No files found.
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
View file @
f1faab07
...
...
@@ -18,6 +18,8 @@
9663F9501C7A74FC00AF0965
/* AppRightViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F94F1C7A74FC00AF0965
/* AppRightViewController.swift */
;
};
9663F9521C7A751D00AF0965
/* FeedViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9511C7A751D00AF0965
/* FeedViewController.swift */
;
};
96CC08881C7FEBD60034FF84
/* InboxViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96CC08871C7FEBD60034FF84
/* InboxViewController.swift */
;
};
96D528661C81EB9E00D3BDD1
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D528651C81EB9E00D3BDD1
/* Material.framework */
;
};
96D528671C81EB9E00D3BDD1
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96D528651C81EB9E00D3BDD1
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
...
...
@@ -27,6 +29,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
96D528671C81EB9E00D3BDD1
/* Material.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -47,6 +50,7 @@
9663F94F1C7A74FC00AF0965
/* AppRightViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppRightViewController.swift
;
sourceTree
=
"<group>"
;
};
9663F9511C7A751D00AF0965
/* FeedViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FeedViewController.swift
;
sourceTree
=
"<group>"
;
};
96CC08871C7FEBD60034FF84
/* InboxViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
InboxViewController.swift
;
sourceTree
=
"<group>"
;
};
96D528651C81EB9E00D3BDD1
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
Material.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"
;
sourceTree
=
"<absolute>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -54,6 +58,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
96D528661C81EB9E00D3BDD1
/* Material.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -63,6 +68,7 @@
9663F9251C7A744500AF0965
=
{
isa
=
PBXGroup
;
children
=
(
96D528651C81EB9E00D3BDD1
/* Material.framework */
,
9663F9301C7A744600AF0965
/* App */
,
9663F92F1C7A744600AF0965
/* Products */
,
);
...
...
Sources/MaterialButton.swift
View file @
f1faab07
...
...
@@ -192,17 +192,20 @@ public class MaterialButton : UIButton {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
...
...
@@ -231,16 +234,22 @@ public class MaterialButton : UIButton {
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
=
0
{
didSet
{
layer
.
borderWidth
=
borderWidth
public
var
borderWidth
:
CGFloat
{
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -305,6 +314,7 @@ public class MaterialButton : UIButton {
if
self
.
layer
==
layer
{
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
...
...
@@ -438,6 +448,11 @@ public class MaterialButton : UIButton {
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
...
...
Sources/MaterialCollectionViewCell.swift
View file @
f1faab07
...
...
@@ -229,17 +229,20 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
...
...
@@ -260,17 +263,30 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
None
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
borderWidthPreset
)
}
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
{
didSet
{
layer
.
borderWidth
=
borderWidth
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -302,7 +318,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
depth
=
.
None
cornerRadiusPreset
=
.
None
shape
=
.
None
borderWidth
=
0
super
.
init
(
coder
:
aDecoder
)
prepareView
()
}
...
...
@@ -317,7 +332,6 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
depth
=
.
None
cornerRadiusPreset
=
.
None
shape
=
.
None
borderWidth
=
0
super
.
init
(
frame
:
frame
)
prepareView
()
}
...
...
@@ -333,6 +347,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
if
self
.
layer
==
layer
{
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
...
...
@@ -467,6 +482,11 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
...
...
Sources/MaterialLayer.swift
View file @
f1faab07
...
...
@@ -177,9 +177,6 @@ public class MaterialLayer : CAShapeLayer {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
...
...
Sources/MaterialTableViewCell.swift
View file @
f1faab07
...
...
@@ -190,9 +190,12 @@ public class MaterialTableViewCell: UITableViewCell {
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
}
}
...
...
@@ -204,16 +207,22 @@ public class MaterialTableViewCell: UITableViewCell {
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
=
0
{
didSet
{
layer
.
borderWidth
=
borderWidth
public
var
borderWidth
:
CGFloat
{
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -261,6 +270,7 @@ public class MaterialTableViewCell: UITableViewCell {
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
layoutVisualLayer
()
layoutShadowPath
()
}
}
...
...
@@ -392,6 +402,11 @@ public class MaterialTableViewCell: UITableViewCell {
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
...
...
Sources/MaterialView.swift
View file @
f1faab07
...
...
@@ -235,17 +235,20 @@ public class MaterialView : UIView {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
...
...
@@ -274,16 +277,22 @@ public class MaterialView : UIView {
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
=
0
{
didSet
{
layer
.
borderWidth
=
borderWidth
public
var
borderWidth
:
CGFloat
{
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -346,6 +355,7 @@ public class MaterialView : UIView {
if
self
.
layer
==
layer
{
layoutShape
()
layoutVisualLayer
()
layoutShadowPath
()
}
}
...
...
@@ -430,4 +440,9 @@ public class MaterialView : UIView {
layer
.
cornerRadius
=
width
/
2
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
}
Sources/SideNavigationViewController.swift
View file @
f1faab07
...
...
@@ -650,7 +650,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
toggleStatusBar
(
true
)
showView
(
v
)
hide
Depth
(
v
)
show
Depth
(
v
)
delegate
?
.
sideNavigationViewPanDidBegin
?(
self
,
point
:
point
,
position
:
.
Right
)
case
.
Changed
:
...
...
@@ -685,7 +685,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
toggleStatusBar
(
true
)
showView
(
v
)
hide
Depth
(
v
)
show
Depth
(
v
)
delegate
?
.
sideNavigationViewPanDidBegin
?(
self
,
point
:
point
,
position
:
.
Left
)
case
.
Changed
:
...
...
Sources/TextField.swift
View file @
f1faab07
...
...
@@ -171,17 +171,20 @@ public class TextField : UITextField {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
...
...
@@ -208,18 +211,24 @@ public class TextField : UITextField {
borderWidth
=
MaterialBorderToValue
(
borderWidthPreset
)
}
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
=
0
{
didSet
{
layer
.
borderWidth
=
borderWidth
public
var
borderWidth
:
CGFloat
{
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -413,6 +422,7 @@ public class TextField : UITextField {
if
self
.
layer
==
layer
{
bottomBorderLayer
.
frame
=
CGRectMake
(
0
,
bounds
.
height
+
bottomBorderLayerDistance
,
bounds
.
width
,
1
)
layoutShape
()
layoutShadowPath
()
}
}
...
...
@@ -540,6 +550,11 @@ public class TextField : UITextField {
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
/// Prepares the titleLabel property.
private
func
prepareTitleLabel
()
{
if
let
v
:
UILabel
=
titleLabel
{
...
...
Sources/TextView.swift
View file @
f1faab07
...
...
@@ -173,17 +173,20 @@ public class TextView: UITextView {
didSet
{
if
let
v
:
MaterialRadius
=
cornerRadiusPreset
{
cornerRadius
=
MaterialRadiusToValue
(
v
)
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
}
/// A property that accesses the layer.cornerRadius.
public
var
cornerRadius
:
CGFloat
=
0
{
didSet
{
layer
.
cornerRadius
=
cornerRadius
public
var
cornerRadius
:
CGFloat
{
get
{
return
layer
.
cornerRadius
}
set
(
value
)
{
layer
.
cornerRadius
=
value
if
.
Circle
==
shape
{
shape
=
.
None
}
}
}
...
...
@@ -212,16 +215,22 @@ public class TextView: UITextView {
}
/// A property that accesses the layer.borderWith.
public
var
borderWidth
:
CGFloat
=
0
{
didSet
{
layer
.
borderWidth
=
borderWidth
public
var
borderWidth
:
CGFloat
{
get
{
return
layer
.
borderWidth
}
set
(
value
)
{
layer
.
borderWidth
=
value
}
}
/// A property that accesses the layer.borderColor property.
public
var
borderColor
:
UIColor
?
{
didSet
{
layer
.
borderColor
=
borderColor
?
.
CGColor
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CGColor
:
layer
.
borderColor
!
)
}
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CGColor
}
}
...
...
@@ -358,6 +367,7 @@ public class TextView: UITextView {
super
.
layoutSublayersOfLayer
(
layer
)
if
self
.
layer
==
layer
{
layoutShape
()
layoutShadowPath
()
}
}
...
...
@@ -455,6 +465,11 @@ public class TextView: UITextView {
}
}
/// Sets the shadow path.
internal
func
layoutShadowPath
()
{
layer
.
shadowPath
=
.
None
==
depth
?
nil
:
UIBezierPath
(
roundedRect
:
bounds
,
cornerRadius
:
cornerRadius
)
.
CGPath
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
...
...
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