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
d1a6419f
Commit
d1a6419f
authored
Aug 23, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial concept
parent
981b12fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
35 deletions
+101
-35
MaterialKit.xcodeproj/project.pbxproj
+12
-0
Source/FlatButton.swift
+4
-3
Source/Layout.swift
+47
-32
Source/MaterialViewController.swift
+37
-0
Source/RaisedButton.swift
+1
-0
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
d1a6419f
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
objects
=
{
objects
=
{
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
65B965721B8A578D0055B139
/* MaterialViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65B965711B8A578D0055B139
/* MaterialViewController.swift */
;
};
963832421B88DFD80015F710
/* MaterialKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832361B88DFD80015F710
/* MaterialKit.framework */
;
};
963832421B88DFD80015F710
/* MaterialKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832361B88DFD80015F710
/* MaterialKit.framework */
;
};
9638325A1B88E31A0015F710
/* MaterialKitTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832581B88E31A0015F710
/* MaterialKitTests.swift */
;
};
9638325A1B88E31A0015F710
/* MaterialKitTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
963832581B88E31A0015F710
/* MaterialKitTests.swift */
;
};
963832691B88E5BF0015F710
/* Capture.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9638325E1B88E5BF0015F710
/* Capture.swift */
;
};
963832691B88E5BF0015F710
/* Capture.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9638325E1B88E5BF0015F710
/* Capture.swift */
;
};
...
@@ -48,6 +49,7 @@
...
@@ -48,6 +49,7 @@
/* End PBXContainerItemProxy section */
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
65B965711B8A578D0055B139
/* MaterialViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialViewController.swift
;
sourceTree
=
"<group>"
;
};
963832361B88DFD80015F710
/* MaterialKit.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
MaterialKit.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832361B88DFD80015F710
/* MaterialKit.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
MaterialKit.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832411B88DFD80015F710
/* MaterialKitTests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
MaterialKitTests.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832411B88DFD80015F710
/* MaterialKitTests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
MaterialKitTests.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
963832541B88E30F0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
963832541B88E30F0015F710
/* Info.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
...
@@ -89,6 +91,14 @@
...
@@ -89,6 +91,14 @@
/* End PBXFrameworksBuildPhase section */
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
/* Begin PBXGroup section */
65B965731B8A58E60055B139
/* View */
=
{
isa
=
PBXGroup
;
children
=
(
65B965711B8A578D0055B139
/* MaterialViewController.swift */
,
);
name
=
View
;
sourceTree
=
"<group>"
;
};
9638322C1B88DFD80015F710
=
{
9638322C1B88DFD80015F710
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -114,6 +124,7 @@
...
@@ -114,6 +124,7 @@
9638325C1B88E3420015F710
/* Supporting Files */
,
9638325C1B88E3420015F710
/* Supporting Files */
,
9AAC38521B89553800FE6B2D
/* Font */
,
9AAC38521B89553800FE6B2D
/* Font */
,
963832861B8907FE0015F710
/* Layout */
,
963832861B8907FE0015F710
/* Layout */
,
65B965731B8A58E60055B139
/* View */
,
963832761B88E8990015F710
/* Text */
,
963832761B88E8990015F710
/* Text */
,
963832751B88E87B0015F710
/* Button */
,
963832751B88E87B0015F710
/* Button */
,
9AAC384B1B89524E00FE6B2D
/* Card */
,
9AAC384B1B89524E00FE6B2D
/* Card */
,
...
@@ -329,6 +340,7 @@
...
@@ -329,6 +340,7 @@
9638326C1B88E5BF0015F710
/* FlatButton.swift in Sources */
,
9638326C1B88E5BF0015F710
/* FlatButton.swift in Sources */
,
963832711B88E5BF0015F710
/* Text.swift in Sources */
,
963832711B88E5BF0015F710
/* Text.swift in Sources */
,
9638326A1B88E5BF0015F710
/* CapturePreview.swift in Sources */
,
9638326A1B88E5BF0015F710
/* CapturePreview.swift in Sources */
,
65B965721B8A578D0055B139
/* MaterialViewController.swift in Sources */
,
9AAC38541B89559900FE6B2D
/* Roboto.swift in Sources */
,
9AAC38541B89559900FE6B2D
/* Roboto.swift in Sources */
,
963832881B8908180015F710
/* Layout.swift in Sources */
,
963832881B8908180015F710
/* Layout.swift in Sources */
,
9AAC384D1B89528900FE6B2D
/* BasicCard.swift in Sources */
,
9AAC384D1B89528900FE6B2D
/* BasicCard.swift in Sources */
,
...
...
Source/FlatButton.swift
View file @
d1a6419f
...
@@ -23,9 +23,9 @@ public class FlatButton : UIButton {
...
@@ -23,9 +23,9 @@ public class FlatButton : UIButton {
public
var
textColor
:
UIColor
?
public
var
textColor
:
UIColor
?
public
var
pulseColor
:
UIColor
?
public
var
pulseColor
:
UIColor
?
private
var
vLine
:
UIView
=
UIView
()
private
lazy
var
vLine
:
UIView
=
UIView
()
private
var
hLine
:
UIView
=
UIView
()
private
lazy
var
hLine
:
UIView
=
UIView
()
private
var
backgroundColorView
:
UIView
=
UIView
()
private
lazy
var
backgroundColorView
:
UIView
=
UIView
()
private
var
pulseView
:
UIView
?
private
var
pulseView
:
UIView
?
public
override
func
drawRect
(
rect
:
CGRect
)
{
public
override
func
drawRect
(
rect
:
CGRect
)
{
...
@@ -65,6 +65,7 @@ public class FlatButton : UIButton {
...
@@ -65,6 +65,7 @@ public class FlatButton : UIButton {
backgroundColorView
.
layer
.
cornerRadius
=
3.0
backgroundColorView
.
layer
.
cornerRadius
=
3.0
backgroundColorView
.
backgroundColor
=
UIColor
.
clearColor
()
backgroundColorView
.
backgroundColor
=
UIColor
.
clearColor
()
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
userInteractionEnabled
=
false
self
.
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
self
.
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
}
}
...
...
Source/Layout.swift
View file @
d1a6419f
...
@@ -19,43 +19,58 @@
...
@@ -19,43 +19,58 @@
import
UIKit
import
UIKit
public
struct
Layout
{
public
struct
Layout
{
public
static
func
topRight
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
,
height
:
CGFloat
,
top
:
CGFloat
,
right
:
CGFloat
)
{
public
static
func
width
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
)
{
parent
.
addSubview
(
child
)
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"width"
:
width
]
var
metrics
=
[
"width"
:
width
,
"height"
:
height
,
"top"
:
top
,
"right"
:
right
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
var
views
=
[
"view"
:
child
]
constraint
(
parent
,
constraint
:
"H:[child(width)]"
,
metrics
:
metrics
,
views
:
views
)
var
viewBindingsDict
:
NSMutableDictionary
=
NSMutableDictionary
()
viewBindingsDict
.
setValue
(
child
,
forKey
:
"child"
)
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:[child(width)]-(right)-|"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|-(top)-[child(height)]"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
}
}
public
static
func
topLeft
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
,
height
:
CGFloat
,
top
:
CGFloat
,
left
:
CGFloat
)
{
public
static
func
height
(
parent
:
UIView
,
child
:
UIView
,
height
:
CGFloat
)
{
parent
.
addSubview
(
child
)
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"height"
:
height
]
var
metrics
=
[
"width"
:
width
,
"height"
:
height
,
"top"
:
top
,
"left"
:
left
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
var
views
=
[
"view"
:
child
]
constraint
(
parent
,
constraint
:
"V:[child(height)]"
,
metrics
:
metrics
,
views
:
views
)
var
viewBindingsDict
:
NSMutableDictionary
=
NSMutableDictionary
()
viewBindingsDict
.
setValue
(
child
,
forKey
:
"child"
)
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|-(left)-[child(width)]"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|-(top)-[child(height)]"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
}
}
public
static
func
bottomRight
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
,
height
:
CGFloat
,
bottom
:
CGFloat
,
right
:
CGFloat
)
{
public
static
func
size
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
,
height
:
CGFloat
)
{
parent
.
addSubview
(
child
)
Layout
.
width
(
parent
,
child
:
child
,
width
:
width
)
var
metrics
=
[
"width"
:
width
,
"height"
:
height
,
"bottom"
:
bottom
,
"right"
:
right
]
Layout
.
height
(
parent
,
child
:
child
,
height
:
height
)
var
views
=
[
"view"
:
child
]
var
viewBindingsDict
:
NSMutableDictionary
=
NSMutableDictionary
()
viewBindingsDict
.
setValue
(
child
,
forKey
:
"child"
)
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:[child(width)]-(right)-|"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:[child(height)]-(bottom)-|"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
}
}
public
static
func
bottomLeft
(
parent
:
UIView
,
child
:
UIView
,
width
:
CGFloat
,
height
:
CGFloat
,
bottom
:
CGFloat
,
left
:
CGFloat
)
{
public
static
func
alignFromTopLeft
(
parent
:
UIView
,
child
:
UIView
,
top
:
CGFloat
,
left
:
CGFloat
)
{
parent
.
addSubview
(
child
)
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"top"
:
top
,
"left"
:
left
]
var
metrics
=
[
"width"
:
width
,
"height"
:
height
,
"bottom"
:
bottom
,
"left"
:
left
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
var
views
=
[
"view"
:
child
]
constraint
(
parent
,
constraint
:
"H:|-(left)-[child]"
,
metrics
:
metrics
,
views
:
views
)
var
viewBindingsDict
:
NSMutableDictionary
=
NSMutableDictionary
()
constraint
(
parent
,
constraint
:
"V:|-(top)-[child]"
,
metrics
:
metrics
,
views
:
views
)
viewBindingsDict
.
setValue
(
child
,
forKey
:
"child"
)
}
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|-(left)-[child(width)]"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:[child(height)]-(bottom)-|"
,
options
:
nil
,
metrics
:
metrics
,
views
:
viewBindingsDict
as
[
NSObject
:
AnyObject
]))
public
static
func
alignFromTopRight
(
parent
:
UIView
,
child
:
UIView
,
top
:
CGFloat
,
right
:
CGFloat
)
{
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"top"
:
top
,
"right"
:
right
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
constraint
(
parent
,
constraint
:
"H:[child]-(right)-|"
,
metrics
:
metrics
,
views
:
views
)
constraint
(
parent
,
constraint
:
"V:|-(top)-[child]"
,
metrics
:
metrics
,
views
:
views
)
}
public
static
func
alignFromBottomLeft
(
parent
:
UIView
,
child
:
UIView
,
bottom
:
CGFloat
,
left
:
CGFloat
)
{
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"bottom"
:
bottom
,
"left"
:
left
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
constraint
(
parent
,
constraint
:
"H:|-(left)-[child]"
,
metrics
:
metrics
,
views
:
views
)
constraint
(
parent
,
constraint
:
"V:[child]-(bottom)-|"
,
metrics
:
metrics
,
views
:
views
)
}
public
static
func
alignFromBottomRight
(
parent
:
UIView
,
child
:
UIView
,
bottom
:
CGFloat
,
right
:
CGFloat
)
{
let
metrics
:
Dictionary
<
String
,
AnyObject
>
=
[
"bottom"
:
bottom
,
"right"
:
right
]
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
constraint
(
parent
,
constraint
:
"H:[child]-(right)-|"
,
metrics
:
metrics
,
views
:
views
)
constraint
(
parent
,
constraint
:
"V:[child]-(bottom)-|"
,
metrics
:
metrics
,
views
:
views
)
}
private
static
func
constraint
(
parent
:
UIView
,
constraint
:
String
,
metrics
:
Dictionary
<
String
,
AnyObject
>
,
views
:
Dictionary
<
String
,
AnyObject
>
)
{
parent
.
addConstraints
(
NSLayoutConstraint
.
constraintsWithVisualFormat
(
constraint
,
options
:
nil
,
metrics
:
metrics
,
views
:
views
)
)
}
}
}
}
Source/MaterialViewController.swift
0 → 100644
View file @
d1a6419f
//
// 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
MaterialViewController
:
UIViewController
{
public
func
topLeft
(
child
:
UIView
,
top
:
CGFloat
,
left
:
CGFloat
)
{
Layout
.
alignFromTopLeft
(
view
,
child
:
child
,
top
:
top
,
left
:
left
)
}
public
func
topRight
(
child
:
UIView
,
top
:
CGFloat
,
right
:
CGFloat
)
{
Layout
.
alignFromTopRight
(
view
,
child
:
child
,
top
:
top
,
right
:
right
)
}
public
func
bottomLeft
(
child
:
UIView
,
bottom
:
CGFloat
,
left
:
CGFloat
)
{
Layout
.
alignFromBottomLeft
(
view
,
child
:
child
,
bottom
:
bottom
,
left
:
left
)
}
public
func
bottomRight
(
child
:
UIView
,
bottom
:
CGFloat
,
right
:
CGFloat
)
{
Layout
.
alignFromBottomRight
(
view
,
child
:
child
,
bottom
:
bottom
,
right
:
right
)
}
}
Source/RaisedButton.swift
View file @
d1a6419f
...
@@ -66,6 +66,7 @@ public class RaisedButton : UIButton {
...
@@ -66,6 +66,7 @@ public class RaisedButton : UIButton {
backgroundColorView
.
layer
.
cornerRadius
=
3.0
backgroundColorView
.
layer
.
cornerRadius
=
3.0
backgroundColorView
.
backgroundColor
=
color
backgroundColorView
.
backgroundColor
=
color
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
userInteractionEnabled
=
false
self
.
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
self
.
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
}
}
...
...
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