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
dbcd077e
Commit
dbcd077e
authored
Sep 14, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
references to NSAttributedStringKey clean up
parent
45363976
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
Sources/iOS/Material+NSMutableAttributedString.swift
+13
-13
Sources/iOS/Material+UIFont.swift
+2
-2
Sources/iOS/SearchBar.swift
+2
-2
No files found.
Sources/iOS/Material+NSMutableAttributedString.swift
View file @
dbcd077e
...
...
@@ -33,44 +33,44 @@ import UIKit
extension
NSMutableAttributedString
{
/**
Adds a Dictionary of NSAttributedStringKeys for a given range.
- Parameter _
stringK
eys: A Dictionary of NSAttributedStringKey type keys and Any type values.
- Parameter _
k
eys: A Dictionary of NSAttributedStringKey type keys and Any type values.
- Parameter range: A NSRange.
*/
open
func
addAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
stringK
eys
{
open
func
addAttributes
(
_
k
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
k
eys
{
addAttribute
(
k
,
value
:
v
,
range
:
range
)
}
}
/**
Updates a NSAttributedStringKey for a given range.
- Parameter _
stringK
ey: A NSAttributedStringKey.
- Parameter _
k
ey: A NSAttributedStringKey.
- Parameter value: Any type.
- Parameter range: A NSRange.
*/
open
func
updateAttribute
(
_
stringK
ey
:
NSAttributedStringKey
,
value
:
Any
,
range
:
NSRange
)
{
removeAttribute
(
stringK
ey
,
range
:
range
)
addAttribute
(
stringK
ey
,
value
:
value
,
range
:
range
)
open
func
updateAttribute
(
_
k
ey
:
NSAttributedStringKey
,
value
:
Any
,
range
:
NSRange
)
{
removeAttribute
(
k
ey
,
range
:
range
)
addAttribute
(
k
ey
,
value
:
value
,
range
:
range
)
}
/**
Updates a Dictionary of NSAttributedStringKeys for a given range.
- Parameter _
stringK
eys: A Dictionary of NSAttributedStringKey type keys and Any type values.
- Parameter _
k
eys: A Dictionary of NSAttributedStringKey type keys and Any type values.
- Parameter range: A NSRange.
*/
open
func
updateAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
stringK
eys
{
open
func
updateAttributes
(
_
k
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
k
eys
{
updateAttribute
(
k
,
value
:
v
,
range
:
range
)
}
}
/**
Removes a Dictionary of NSAttributedStringKeys for a given range.
- Parameter _
stringK
eys: An Array of attributedStringKeys.
- Parameter _
k
eys: An Array of attributedStringKeys.
- Parameter range: A NSRange.
*/
open
func
removeAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
],
range
:
NSRange
)
{
for
k
in
stringK
eys
{
open
func
removeAttributes
(
_
k
eys
:
[
NSAttributedStringKey
],
range
:
NSRange
)
{
for
k
in
k
eys
{
removeAttribute
(
k
,
range
:
range
)
}
}
...
...
Sources/iOS/Material+UIFont.swift
View file @
dbcd077e
...
...
@@ -40,8 +40,8 @@ extension UIFont {
*/
open
func
stringSize
(
string
:
String
,
constrainedTo
width
:
CGFloat
)
->
CGSize
{
return
string
.
boundingRect
(
with
:
CGSize
(
width
:
width
,
height
:
CGFloat
(
Double
.
greatestFiniteMagnitude
)),
options
:
NSStringDrawingOptions
.
usesLineFragmentOrigin
,
attributes
:
[
NSAttributedStringKey
.
font
:
self
],
options
:
.
usesLineFragmentOrigin
,
attributes
:
[
.
font
:
self
],
context
:
nil
)
.
size
}
}
Sources/iOS/SearchBar.swift
View file @
dbcd077e
...
...
@@ -109,7 +109,7 @@ open class SearchBar: Bar {
open
var
placeholder
:
String
?
{
didSet
{
if
let
v
=
placeholder
{
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSAttributedStringKey
.
foregroundColor
:
placeholderColor
])
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
.
foregroundColor
:
placeholderColor
])
}
}
}
...
...
@@ -119,7 +119,7 @@ open class SearchBar: Bar {
open
var
placeholderColor
=
Color
.
darkText
.
others
{
didSet
{
if
let
v
=
placeholder
{
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSAttributedStringKey
.
foregroundColor
:
placeholderColor
])
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
.
foregroundColor
:
placeholderColor
])
}
}
}
...
...
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