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
b5ac48a4
Commit
b5ac48a4
authored
Oct 08, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added defaults for MaterialTextLayer
parent
815e678f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
29 deletions
+44
-29
Source/MaterialLayer.swift
+0
-1
Source/MaterialTextLayer.swift
+25
-27
Source/MaterialTheme.swift
+19
-1
No files found.
Source/MaterialLayer.swift
View file @
b5ac48a4
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
import
UIKit
import
UIKit
public
class
MaterialLayer
:
CAShapeLayer
{
public
class
MaterialLayer
:
CAShapeLayer
{
/**
/**
:name: init
:name: init
*/
*/
...
...
Source/MaterialTextLayer.swift
View file @
b5ac48a4
...
@@ -19,7 +19,10 @@
...
@@ -19,7 +19,10 @@
import
UIKit
import
UIKit
public
extension
UIFont
{
public
extension
UIFont
{
func
sizeOfString
(
string
:
String
,
constrainedToWidth
width
:
Double
)
->
CGSize
{
/**
:name: sizeOfString
*/
public
func
sizeOfString
(
string
:
String
,
constrainedToWidth
width
:
Double
)
->
CGSize
{
return
string
.
boundingRectWithSize
(
CGSize
(
width
:
width
,
height
:
DBL_MAX
),
return
string
.
boundingRectWithSize
(
CGSize
(
width
:
width
,
height
:
DBL_MAX
),
options
:
NSStringDrawingOptions
.
UsesLineFragmentOrigin
,
options
:
NSStringDrawingOptions
.
UsesLineFragmentOrigin
,
attributes
:
[
NSFontAttributeName
:
self
],
attributes
:
[
NSFontAttributeName
:
self
],
...
@@ -28,17 +31,14 @@ public extension UIFont {
...
@@ -28,17 +31,14 @@ public extension UIFont {
}
}
public
class
MaterialTextLayer
:
CATextLayer
{
public
class
MaterialTextLayer
:
CATextLayer
{
/**
//
:name: text
// :name: internalFont
*/
//
public
var
text
:
String
?
{
didSet
{
string
=
text
as?
AnyObject
}
}
private
var
internalFont
:
UIFont
?
private
var
internalFont
:
UIFont
?
/**
:name: font
*/
public
override
var
font
:
AnyObject
?
{
public
override
var
font
:
AnyObject
?
{
get
{
get
{
return
internalFont
return
internalFont
...
@@ -53,25 +53,22 @@ public class MaterialTextLayer : CATextLayer {
...
@@ -53,25 +53,22 @@ public class MaterialTextLayer : CATextLayer {
}
}
/**
/**
:name:
pointSize
:name:
text
*/
*/
public
var
pointSize
:
CGFloat
=
10
{
public
var
text
:
String
?
{
didSet
{
didSet
{
fontSize
=
pointSize
string
=
text
as?
AnyObject
}
}
}
}
/**
/**
:name:
font
:name:
pointSize
*/
*/
// public override var font: AnyObject? {
public
var
pointSize
:
CGFloat
=
10
{
//// didSet {
didSet
{
//// if let v = font as? UIFont {
fontSize
=
pointSize
//// super.font = CGFontCreateWithFontName(v.fontName as CFStringRef)!
}
//// pointSize = v.pointSize
}
//// }
//// }
// }
/**
/**
:name: textColor
:name: textColor
...
@@ -169,11 +166,12 @@ public class MaterialTextLayer : CATextLayer {
...
@@ -169,11 +166,12 @@ public class MaterialTextLayer : CATextLayer {
// :name: prepareLayer
// :name: prepareLayer
//
//
internal
func
prepareLayer
()
{
internal
func
prepareLayer
()
{
textColor
=
MaterialColor
.
black
textColor
=
MaterialTheme
.
textLayer
.
textColor
textAlignment
=
MaterialTheme
.
label
.
textAlignment
textAlignment
=
MaterialTheme
.
textLayer
.
textAlignment
wrapped
=
MaterialTheme
.
label
.
wrapped
wrapped
=
MaterialTheme
.
textLayer
.
wrapped
contentsScale
=
MaterialTheme
.
label
.
contentsScale
contentsScale
=
MaterialTheme
.
textLayer
.
contentsScale
font
=
MaterialTheme
.
label
.
font
font
=
MaterialTheme
.
textLayer
.
font
lineBreakMode
=
MaterialTheme
.
textLayer
.
lineBreakMode
}
}
}
}
Source/MaterialTheme.swift
View file @
b5ac48a4
...
@@ -24,6 +24,7 @@ public struct MaterialTheme {
...
@@ -24,6 +24,7 @@ public struct MaterialTheme {
public
struct
basicCardView
{}
public
struct
basicCardView
{}
public
struct
imageCardView
{}
public
struct
imageCardView
{}
public
struct
navigationBarView
{}
public
struct
navigationBarView
{}
public
struct
textLayer
{}
public
struct
label
{}
public
struct
label
{}
public
struct
flatButton
{}
public
struct
flatButton
{}
public
struct
raisedButton
{}
public
struct
raisedButton
{}
...
@@ -216,6 +217,23 @@ public extension MaterialTheme.navigationBarView {
...
@@ -216,6 +217,23 @@ public extension MaterialTheme.navigationBarView {
public
static
var
zPosition
:
CGFloat
=
100
public
static
var
zPosition
:
CGFloat
=
100
}
}
// textLayer
public
extension
MaterialTheme
.
textLayer
{
// scale
public
static
var
contentsScale
:
CGFloat
=
UIScreen
.
mainScreen
()
.
scale
// alignment
public
static
var
wrapped
:
Bool
=
true
public
static
var
textAlignment
:
NSTextAlignment
=
.
Left
public
static
var
lineBreakMode
:
NSLineBreakMode
=
.
ByWordWrapping
// font
public
static
var
font
:
UIFont
=
RobotoFont
.
regular
// color
public
static
var
textColor
:
UIColor
=
MaterialColor
.
black
}
// label
// label
public
extension
MaterialTheme
.
label
{
public
extension
MaterialTheme
.
label
{
// scale
// scale
...
@@ -226,7 +244,7 @@ public extension MaterialTheme.label {
...
@@ -226,7 +244,7 @@ public extension MaterialTheme.label {
public
static
var
textAlignment
:
NSTextAlignment
=
.
Left
public
static
var
textAlignment
:
NSTextAlignment
=
.
Left
// font
// font
public
static
var
font
:
UIFont
=
RobotoFont
.
regular
WithSize
(
20
)
public
static
var
font
:
UIFont
=
RobotoFont
.
regular
}
}
// flatButton
// flatButton
...
...
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