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
b630406a
Commit
b630406a
authored
Sep 03, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue-27: updated naming for Views and Text
parent
756b9643
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
101 deletions
+80
-101
MaterialKit.xcodeproj/project.pbxproj
+0
-0
Source/BasicCardView.swift
+6
-6
Source/FlatButton.swift
+1
-1
Source/ImageCardView.swift
+6
-6
Source/Info.plist
+1
-1
Source/MaterialButton.swift
+1
-1
Source/MaterialCardView.swift
+2
-2
Source/MaterialText.swift
+10
-10
Source/MaterialTextStorage.swift
+5
-5
Source/RaisedButton.swift
+1
-1
Source/TextView.swift
+47
-68
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
b630406a
This diff is collapsed.
Click to expand it.
Source/BasicCard.swift
→
Source/BasicCard
View
.swift
View file @
b630406a
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
import
UIKit
import
UIKit
public
class
BasicCard
:
MaterialCard
,
Comparable
,
Equatable
{
public
class
BasicCard
View
:
MaterialCardView
,
Comparable
,
Equatable
{
//
//
// :name: layoutConstraints
// :name: layoutConstraints
//
//
...
@@ -277,22 +277,22 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
...
@@ -277,22 +277,22 @@ public class BasicCard : MaterialCard, Comparable, Equatable {
}
}
}
}
public
func
==
(
lhs
:
BasicCard
,
rhs
:
BasicCard
)
->
Bool
{
public
func
==
(
lhs
:
BasicCard
View
,
rhs
:
BasicCardView
)
->
Bool
{
return
lhs
.
tag
==
rhs
.
tag
return
lhs
.
tag
==
rhs
.
tag
}
}
public
func
<=
(
lhs
:
BasicCard
,
rhs
:
BasicCard
)
->
Bool
{
public
func
<=
(
lhs
:
BasicCard
View
,
rhs
:
BasicCardView
)
->
Bool
{
return
lhs
.
tag
<=
rhs
.
tag
return
lhs
.
tag
<=
rhs
.
tag
}
}
public
func
>=
(
lhs
:
BasicCard
,
rhs
:
BasicCard
)
->
Bool
{
public
func
>=
(
lhs
:
BasicCard
View
,
rhs
:
BasicCardView
)
->
Bool
{
return
lhs
.
tag
>=
rhs
.
tag
return
lhs
.
tag
>=
rhs
.
tag
}
}
public
func
>
(
lhs
:
BasicCard
,
rhs
:
BasicCard
)
->
Bool
{
public
func
>
(
lhs
:
BasicCard
View
,
rhs
:
BasicCardView
)
->
Bool
{
return
lhs
.
tag
>
rhs
.
tag
return
lhs
.
tag
>
rhs
.
tag
}
}
public
func
<
(
lhs
:
BasicCard
,
rhs
:
BasicCard
)
->
Bool
{
public
func
<
(
lhs
:
BasicCard
View
,
rhs
:
BasicCardView
)
->
Bool
{
return
lhs
.
tag
<
rhs
.
tag
return
lhs
.
tag
<
rhs
.
tag
}
}
Source/FlatButton.swift
View file @
b630406a
...
@@ -24,7 +24,7 @@ public class FlatButton : MaterialButton {
...
@@ -24,7 +24,7 @@ public class FlatButton : MaterialButton {
//
//
internal
override
func
prepareView
()
{
internal
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
indigo
.
darken1
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
blue
.
darken1
,
forState
:
.
Normal
)
backgroundColor
=
MaterialTheme
.
clear
.
color
backgroundColor
=
MaterialTheme
.
clear
.
color
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
}
}
...
...
Source/ImageCard.swift
→
Source/ImageCard
View
.swift
View file @
b630406a
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
import
UIKit
import
UIKit
public
class
ImageCard
:
MaterialCard
,
Comparable
,
Equatable
{
public
class
ImageCard
View
:
MaterialCardView
,
Comparable
,
Equatable
{
//
//
// :name: layoutConstraints
// :name: layoutConstraints
//
//
...
@@ -351,22 +351,22 @@ public class ImageCard : MaterialCard, Comparable, Equatable {
...
@@ -351,22 +351,22 @@ public class ImageCard : MaterialCard, Comparable, Equatable {
}
}
}
}
public
func
==
(
lhs
:
ImageCard
,
rhs
:
ImageCard
)
->
Bool
{
public
func
==
(
lhs
:
ImageCard
View
,
rhs
:
ImageCardView
)
->
Bool
{
return
lhs
.
tag
==
rhs
.
tag
return
lhs
.
tag
==
rhs
.
tag
}
}
public
func
<=
(
lhs
:
ImageCard
,
rhs
:
ImageCard
)
->
Bool
{
public
func
<=
(
lhs
:
ImageCard
View
,
rhs
:
ImageCardView
)
->
Bool
{
return
lhs
.
tag
<=
rhs
.
tag
return
lhs
.
tag
<=
rhs
.
tag
}
}
public
func
>=
(
lhs
:
ImageCard
,
rhs
:
ImageCard
)
->
Bool
{
public
func
>=
(
lhs
:
ImageCard
View
,
rhs
:
ImageCardView
)
->
Bool
{
return
lhs
.
tag
>=
rhs
.
tag
return
lhs
.
tag
>=
rhs
.
tag
}
}
public
func
>
(
lhs
:
ImageCard
,
rhs
:
ImageCard
)
->
Bool
{
public
func
>
(
lhs
:
ImageCard
View
,
rhs
:
ImageCardView
)
->
Bool
{
return
lhs
.
tag
>
rhs
.
tag
return
lhs
.
tag
>
rhs
.
tag
}
}
public
func
<
(
lhs
:
ImageCard
,
rhs
:
ImageCard
)
->
Bool
{
public
func
<
(
lhs
:
ImageCard
View
,
rhs
:
ImageCardView
)
->
Bool
{
return
lhs
.
tag
<
rhs
.
tag
return
lhs
.
tag
<
rhs
.
tag
}
}
Source/Info.plist
View file @
b630406a
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.
7
.0
<
/string
>
<
string
>
1.
8
.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
Source/MaterialButton.swift
View file @
b630406a
...
@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
...
@@ -44,7 +44,7 @@ public class MaterialButton : UIButton {
/**
/**
:name: pulseColor
:name: pulseColor
*/
*/
public
var
pulseColor
:
UIColor
?
=
MaterialTheme
.
indigo
.
lighten3
public
var
pulseColor
:
UIColor
?
=
MaterialTheme
.
blue
.
lighten3
/**
/**
:name: init
:name: init
...
...
Source/MaterialCard.swift
→
Source/MaterialCard
View
.swift
View file @
b630406a
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
import
UIKit
import
UIKit
public
class
MaterialCard
:
UIView
{
public
class
MaterialCard
View
:
UIView
{
//
//
// :name: backgroundColorView
// :name: backgroundColorView
//
//
...
@@ -49,7 +49,7 @@ public class MaterialCard : UIView {
...
@@ -49,7 +49,7 @@ public class MaterialCard : UIView {
/**
/**
:name: pulseColor
:name: pulseColor
*/
*/
public
var
pulseColor
:
UIColor
=
MaterialTheme
.
indigo
.
lighten3
public
var
pulseColor
:
UIColor
=
MaterialTheme
.
blue
.
lighten3
/**
/**
:name: init
:name: init
...
...
Source/Text.swift
→
Source/
Material
Text.swift
View file @
b630406a
...
@@ -18,14 +18,14 @@
...
@@ -18,14 +18,14 @@
import
UIKit
import
UIKit
@objc(TextDelegate)
@objc(
Material
TextDelegate)
public
protocol
TextDelegate
{
public
protocol
TextDelegate
{
optional
func
textStorageWillProcessEdit
(
text
:
Text
,
textStorage
:
TextStorage
,
string
:
String
,
range
:
NSRange
)
optional
func
textStorageWillProcessEdit
(
text
:
MaterialText
,
textStorage
:
Material
TextStorage
,
string
:
String
,
range
:
NSRange
)
optional
func
textStorageDidProcessEdit
(
text
:
Text
,
textStorage
:
TextStorage
,
string
:
String
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
optional
func
textStorageDidProcessEdit
(
text
:
MaterialText
,
textStorage
:
Material
TextStorage
,
string
:
String
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
}
}
@objc(Text)
@objc(
Material
Text)
public
class
Text
:
NSObject
{
public
class
Material
Text
:
NSObject
{
/**
/**
:name: searchPattern
:name: searchPattern
:description: A string representation of the regular expression that matches text within
:description: A string representation of the regular expression that matches text within
...
@@ -42,7 +42,7 @@ public class Text: NSObject {
...
@@ -42,7 +42,7 @@ public class Text: NSObject {
:name: textStorage
:name: textStorage
:description: Reference to wrapped NSTextStorage
:description: Reference to wrapped NSTextStorage
*/
*/
public
let
textStorage
:
TextStorage
public
let
textStorage
:
Material
TextStorage
/**
/**
:name: delegate
:name: delegate
...
@@ -53,14 +53,14 @@ public class Text: NSObject {
...
@@ -53,14 +53,14 @@ public class Text: NSObject {
/**
/**
:name: init
:name: init
*/
*/
override
public
init
()
{
public
override
init
()
{
textStorage
=
TextStorage
()
textStorage
=
Material
TextStorage
()
super
.
init
()
super
.
init
()
textStorage
.
searchExpression
=
NSRegularExpression
(
pattern
:
searchPattern
,
options
:
nil
,
error
:
nil
)
textStorage
.
searchExpression
=
NSRegularExpression
(
pattern
:
searchPattern
,
options
:
nil
,
error
:
nil
)
textStorage
.
textStorageWillProcessEdit
=
{
(
textStorage
:
TextStorage
,
string
:
String
,
range
:
NSRange
)
->
Void
in
textStorage
.
textStorageWillProcessEdit
=
{
(
textStorage
:
Material
TextStorage
,
string
:
String
,
range
:
NSRange
)
->
Void
in
self
.
delegate
?
.
textStorageWillProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
string
,
range
:
range
)
self
.
delegate
?
.
textStorageWillProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
string
,
range
:
range
)
}
}
textStorage
.
textStorageDidProcessEdit
=
{
(
textStorage
:
TextStorage
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
in
textStorage
.
textStorageDidProcessEdit
=
{
(
textStorage
:
Material
TextStorage
,
result
:
NSTextCheckingResult
,
flags
:
NSMatchingFlags
,
stop
:
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
in
self
.
delegate
?
.
textStorageDidProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
textStorage
.
string
,
result
:
result
,
flags
:
flags
,
stop
:
stop
)
self
.
delegate
?
.
textStorageDidProcessEdit
?(
self
,
textStorage
:
textStorage
,
string
:
textStorage
.
string
,
result
:
result
,
flags
:
flags
,
stop
:
stop
)
}
}
}
}
...
...
Source/TextStorage.swift
→
Source/
Material
TextStorage.swift
View file @
b630406a
...
@@ -18,10 +18,10 @@
...
@@ -18,10 +18,10 @@
import
UIKit
import
UIKit
internal
typealias
TextStorageWillProcessEdit
=
(
TextStorage
,
String
,
NSRange
)
->
Void
internal
typealias
MaterialTextStorageWillProcessEdit
=
(
Material
TextStorage
,
String
,
NSRange
)
->
Void
internal
typealias
TextStorageDidProcessEdit
=
(
TextStorage
,
NSTextCheckingResult
,
NSMatchingFlags
,
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
internal
typealias
MaterialTextStorageDidProcessEdit
=
(
Material
TextStorage
,
NSTextCheckingResult
,
NSMatchingFlags
,
UnsafeMutablePointer
<
ObjCBool
>
)
->
Void
public
class
TextStorage
:
NSTextStorage
{
public
class
Material
TextStorage
:
NSTextStorage
{
/**
/**
:name: store
:name: store
:description: Acts as the model, storing the string value.
:description: Acts as the model, storing the string value.
...
@@ -39,14 +39,14 @@ public class TextStorage: NSTextStorage {
...
@@ -39,14 +39,14 @@ public class TextStorage: NSTextStorage {
:description: If set, this block callback executes when there is a change in the TextStorage
:description: If set, this block callback executes when there is a change in the TextStorage
string value.
string value.
*/
*/
internal
var
textStorageWillProcessEdit
:
TextStorageWillProcessEdit
?
internal
var
textStorageWillProcessEdit
:
Material
TextStorageWillProcessEdit
?
/**
/**
:name: textStorageDidProcessEdit
:name: textStorageDidProcessEdit
:description: If set, this block callback executes when a match is detected after a change in
:description: If set, this block callback executes when a match is detected after a change in
the TextStorage string value.
the TextStorage string value.
*/
*/
internal
var
textStorageDidProcessEdit
:
TextStorageDidProcessEdit
?
internal
var
textStorageDidProcessEdit
:
Material
TextStorageDidProcessEdit
?
required
public
init
(
coder
aDecoder
:
NSCoder
)
{
required
public
init
(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
...
...
Source/RaisedButton.swift
View file @
b630406a
...
@@ -25,7 +25,7 @@ public class RaisedButton : MaterialButton {
...
@@ -25,7 +25,7 @@ public class RaisedButton : MaterialButton {
internal
override
func
prepareView
()
{
internal
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
white
.
color
,
forState
:
.
Normal
)
setTitleColor
(
MaterialTheme
.
white
.
color
,
forState
:
.
Normal
)
backgroundColor
=
MaterialTheme
.
indigo
.
darken1
backgroundColor
=
MaterialTheme
.
blue
.
darken1
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
contentEdgeInsets
=
UIEdgeInsetsMake
(
4
,
16
,
4
,
16
)
}
}
...
...
Source/TextView.swift
View file @
b630406a
...
@@ -20,23 +20,23 @@ import UIKit
...
@@ -20,23 +20,23 @@ import UIKit
public
class
TextView
:
UITextView
{
public
class
TextView
:
UITextView
{
//
//
// :name: label
// :name: placeholderconstraints
// :description: Placeholder label.
//
private
lazy
var
label
:
UILabel
=
UILabel
()
//
// :name: labelConstraints
// :description: Autoresize constraints for the placeholder label.
// :description: Autoresize constraints for the placeholder label.
//
//
private
var
labelC
onstraints
:
Array
<
NSLayoutConstraint
>
?
private
var
placeholderc
onstraints
:
Array
<
NSLayoutConstraint
>
?
required
public
init
(
coder
aDecoder
:
NSCoder
)
{
/**
:name: init
*/
public
required
init
(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
super
.
init
(
coder
:
aDecoder
)
prepareView
()
prepareView
()
}
}
override
public
init
(
frame
:
CGRect
,
textContainer
:
NSTextContainer
?)
{
/**
:name: init
*/
public
override
init
(
frame
:
CGRect
,
textContainer
:
NSTextContainer
?)
{
super
.
init
(
frame
:
frame
,
textContainer
:
textContainer
)
super
.
init
(
frame
:
frame
,
textContainer
:
textContainer
)
if
CGRectZero
==
frame
{
if
CGRectZero
==
frame
{
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
...
@@ -56,47 +56,23 @@ public class TextView: UITextView {
...
@@ -56,47 +56,23 @@ public class TextView: UITextView {
:name: placeholder
:name: placeholder
:description: The placeholder label string.
:description: The placeholder label string.
*/
*/
public
var
placeholder
:
String
=
""
{
public
var
placeholder
Label
:
UILabel
?
{
didSet
{
didSet
{
label
.
text
=
placeholder
placeholderLabel
!.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
placeholderLabel
!.
font
=
font
placeholderLabel
!.
textAlignment
=
textAlignment
placeholderLabel
!.
numberOfLines
=
0
placeholderLabel
!.
backgroundColor
=
MaterialTheme
.
clear
.
color
addSubview
(
placeholderLabel
!
)
}
}
}
}
/**
:name: placeholderColor
:description: The placeholder color.
*/
public
var
placeholderColor
:
UIColor
=
MaterialTheme
.
indigo
.
lighten1
{
didSet
{
label
.
textColor
=
placeholderColor
}
}
/**
:name: font
:description: Font to use for placeholder based on UITextView font.
*/
override
public
var
font
:
UIFont
!
{
didSet
{
label
.
font
=
font
}
}
/**
:name: textAlignment
:description: Sets placeholder textAlignment based on UITextView textAlignment.
*/
override
public
var
textAlignment
:
NSTextAlignment
{
didSet
{
label
.
textAlignment
=
textAlignment
}
}
/**
/**
:name: text
:name: text
:description: When set, updates the placeholder text.
:description: When set, updates the placeholder text.
*/
*/
override
public
var
text
:
String
!
{
public
override
var
text
:
String
!
{
didSet
{
didSet
{
textViewTextDidChange
()
textViewTextDidChange
()
}
}
...
@@ -106,7 +82,7 @@ public class TextView: UITextView {
...
@@ -106,7 +82,7 @@ public class TextView: UITextView {
:name: attributedText
:name: attributedText
:description: When set, updates the placeholder attributedText.
:description: When set, updates the placeholder attributedText.
*/
*/
override
public
var
attributedText
:
NSAttributedString
!
{
public
override
var
attributedText
:
NSAttributedString
!
{
didSet
{
didSet
{
textViewTextDidChange
()
textViewTextDidChange
()
}
}
...
@@ -116,15 +92,15 @@ public class TextView: UITextView {
...
@@ -116,15 +92,15 @@ public class TextView: UITextView {
:name: textContainerInset
:name: textContainerInset
:description: When set, updates the placeholder constraints.
:description: When set, updates the placeholder constraints.
*/
*/
override
public
var
textContainerInset
:
UIEdgeInsets
{
public
override
var
textContainerInset
:
UIEdgeInsets
{
didSet
{
didSet
{
updateLabelConstraints
()
updateLabelConstraints
()
}
}
}
}
override
public
func
layoutSubviews
()
{
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
label
.
preferredMaxLayoutWidth
=
textContainer
.
size
.
width
-
textContainer
.
lineFragmentPadding
*
2
placeholderLabel
?
.
preferredMaxLayoutWidth
=
textContainer
.
size
.
width
-
textContainer
.
lineFragmentPadding
*
2
}
}
//
//
...
@@ -132,7 +108,7 @@ public class TextView: UITextView {
...
@@ -132,7 +108,7 @@ public class TextView: UITextView {
// :description: Updates the label visibility when text is empty or not.
// :description: Updates the label visibility when text is empty or not.
//
//
internal
func
textViewTextDidChange
()
{
internal
func
textViewTextDidChange
()
{
label
.
hidden
=
!
text
.
isEmpty
placeholderLabel
?
.
hidden
=
!
text
.
isEmpty
}
}
//
//
...
@@ -140,17 +116,6 @@ public class TextView: UITextView {
...
@@ -140,17 +116,6 @@ public class TextView: UITextView {
// :description: Sets up the common initilized values.
// :description: Sets up the common initilized values.
//
//
private
func
prepareView
()
{
private
func
prepareView
()
{
backgroundColor
=
MaterialTheme
.
clear
.
color
textColor
=
MaterialTheme
.
black
.
color
label
.
font
=
font
label
.
textColor
=
placeholderColor
label
.
textAlignment
=
textAlignment
label
.
text
=
placeholder
label
.
numberOfLines
=
0
label
.
backgroundColor
=
MaterialTheme
.
clear
.
color
label
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
addSubview
(
label
)
// label needs to be added to the view
// label needs to be added to the view
// hierarchy before setting insets
// hierarchy before setting insets
textContainerInset
=
UIEdgeInsetsMake
(
16
,
16
,
16
,
16
)
textContainerInset
=
UIEdgeInsetsMake
(
16
,
16
,
16
,
16
)
...
@@ -164,15 +129,29 @@ public class TextView: UITextView {
...
@@ -164,15 +129,29 @@ public class TextView: UITextView {
// :description: Updates the placeholder constraints.
// :description: Updates the placeholder constraints.
//
//
private
func
updateLabelConstraints
()
{
private
func
updateLabelConstraints
()
{
if
nil
!=
labelConstraints
{
if
nil
!=
placeholderconstraints
{
removeConstraints
(
labelConstraints
!
)
NSLayoutConstraint
.
deactivateConstraints
(
placeholderconstraints
!
)
}
}
var
constraints
:
Array
<
NSLayoutConstraint
>
=
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"H:|-(left)-[placeholder]-(right)-|"
,
options
:
nil
,
metrics
:
[
"left"
:
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
,
"right"
:
textContainerInset
.
right
+
textContainer
.
lineFragmentPadding
],
views
:
[
"placeholder"
:
label
])
as!
Array
<
NSLayoutConstraint
>
placeholderconstraints
=
Layout
.
constraint
(
"H:|-(left)-[placeholder]-(right)-|"
,
options
:
nil
,
constraints
+=
NSLayoutConstraint
.
constraintsWithVisualFormat
(
"V:|-(top)-[placeholder]-(>=bottom)-|"
,
options
:
nil
,
metrics
:
[
"top"
:
textContainerInset
.
top
,
"bottom"
:
textContainerInset
.
bottom
],
views
:
[
"placeholder"
:
label
])
as!
Array
<
NSLayoutConstraint
>
metrics
:
[
"left"
:
textContainerInset
.
left
+
textContainer
.
lineFragmentPadding
,
labelConstraints
=
constraints
"right"
:
textContainerInset
.
right
+
textContainer
.
lineFragmentPadding
addConstraints
(
constraints
)
],
views
:
[
"placeholder"
:
placeholderLabel
!
])
placeholderconstraints
+=
Layout
.
constraint
(
"V:|-(top)-[placeholder]-(>=bottom)-|"
,
options
:
nil
,
metrics
:
[
"top"
:
textContainerInset
.
top
,
"bottom"
:
textContainerInset
.
bottom
],
views
:
[
"placeholder"
:
placeholderLabel
!
])
NSLayoutConstraint
.
activateConstraints
(
placeholderconstraints
!
)
}
}
}
}
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