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
...
@@ -33,44 +33,44 @@ import UIKit
extension
NSMutableAttributedString
{
extension
NSMutableAttributedString
{
/**
/**
Adds a Dictionary of NSAttributedStringKeys for a given range.
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.
- Parameter range: A NSRange.
*/
*/
open
func
addAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
open
func
addAttributes
(
_
k
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
stringK
eys
{
for
(
k
,
v
)
in
k
eys
{
addAttribute
(
k
,
value
:
v
,
range
:
range
)
addAttribute
(
k
,
value
:
v
,
range
:
range
)
}
}
}
}
/**
/**
Updates a NSAttributedStringKey for a given range.
Updates a NSAttributedStringKey for a given range.
- Parameter _
stringK
ey: A NSAttributedStringKey.
- Parameter _
k
ey: A NSAttributedStringKey.
- Parameter value: Any type.
- Parameter value: Any type.
- Parameter range: A NSRange.
- Parameter range: A NSRange.
*/
*/
open
func
updateAttribute
(
_
stringK
ey
:
NSAttributedStringKey
,
value
:
Any
,
range
:
NSRange
)
{
open
func
updateAttribute
(
_
k
ey
:
NSAttributedStringKey
,
value
:
Any
,
range
:
NSRange
)
{
removeAttribute
(
stringK
ey
,
range
:
range
)
removeAttribute
(
k
ey
,
range
:
range
)
addAttribute
(
stringK
ey
,
value
:
value
,
range
:
range
)
addAttribute
(
k
ey
,
value
:
value
,
range
:
range
)
}
}
/**
/**
Updates a Dictionary of NSAttributedStringKeys for a given 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.
- Parameter range: A NSRange.
*/
*/
open
func
updateAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
open
func
updateAttributes
(
_
k
eys
:
[
NSAttributedStringKey
:
Any
],
range
:
NSRange
)
{
for
(
k
,
v
)
in
stringK
eys
{
for
(
k
,
v
)
in
k
eys
{
updateAttribute
(
k
,
value
:
v
,
range
:
range
)
updateAttribute
(
k
,
value
:
v
,
range
:
range
)
}
}
}
}
/**
/**
Removes a Dictionary of NSAttributedStringKeys for a given 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.
- Parameter range: A NSRange.
*/
*/
open
func
removeAttributes
(
_
stringK
eys
:
[
NSAttributedStringKey
],
range
:
NSRange
)
{
open
func
removeAttributes
(
_
k
eys
:
[
NSAttributedStringKey
],
range
:
NSRange
)
{
for
k
in
stringK
eys
{
for
k
in
k
eys
{
removeAttribute
(
k
,
range
:
range
)
removeAttribute
(
k
,
range
:
range
)
}
}
}
}
...
...
Sources/iOS/Material+UIFont.swift
View file @
dbcd077e
...
@@ -40,8 +40,8 @@ extension UIFont {
...
@@ -40,8 +40,8 @@ extension UIFont {
*/
*/
open
func
stringSize
(
string
:
String
,
constrainedTo
width
:
CGFloat
)
->
CGSize
{
open
func
stringSize
(
string
:
String
,
constrainedTo
width
:
CGFloat
)
->
CGSize
{
return
string
.
boundingRect
(
with
:
CGSize
(
width
:
width
,
height
:
CGFloat
(
Double
.
greatestFiniteMagnitude
)),
return
string
.
boundingRect
(
with
:
CGSize
(
width
:
width
,
height
:
CGFloat
(
Double
.
greatestFiniteMagnitude
)),
options
:
NSStringDrawingOptions
.
usesLineFragmentOrigin
,
options
:
.
usesLineFragmentOrigin
,
attributes
:
[
NSAttributedStringKey
.
font
:
self
],
attributes
:
[
.
font
:
self
],
context
:
nil
)
.
size
context
:
nil
)
.
size
}
}
}
}
Sources/iOS/SearchBar.swift
View file @
dbcd077e
...
@@ -109,7 +109,7 @@ open class SearchBar: Bar {
...
@@ -109,7 +109,7 @@ open class SearchBar: Bar {
open
var
placeholder
:
String
?
{
open
var
placeholder
:
String
?
{
didSet
{
didSet
{
if
let
v
=
placeholder
{
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 {
...
@@ -119,7 +119,7 @@ open class SearchBar: Bar {
open
var
placeholderColor
=
Color
.
darkText
.
others
{
open
var
placeholderColor
=
Color
.
darkText
.
others
{
didSet
{
didSet
{
if
let
v
=
placeholder
{
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