Skip to content

Commit 2895506

Browse files
committed
Rename token isHighlighted
1 parent 4956710 commit 2895506

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Source/TokenField/ICToken.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ICToken: UIView {
3535
}
3636
}
3737

38-
var highlighted = false {
38+
var isHighlighted = false {
3939
didSet {
4040
updateTextLabel()
4141
}
@@ -46,7 +46,7 @@ class ICToken: UIView {
4646
NSBackgroundColorAttributeName: UIColor.clear
4747
] {
4848
didSet {
49-
if !highlighted { updateTextLabel() }
49+
if !isHighlighted { updateTextLabel() }
5050
delimiterLabel.textColor = self.normalTextAttributes[NSForegroundColorAttributeName] as? UIColor
5151
}
5252
}
@@ -56,7 +56,7 @@ class ICToken: UIView {
5656
NSBackgroundColorAttributeName: UIColor(red:0.14, green:0.38, blue:0.95, alpha:1)
5757
] {
5858
didSet {
59-
if highlighted { updateTextLabel() }
59+
if isHighlighted { updateTextLabel() }
6060
}
6161
}
6262

@@ -104,7 +104,7 @@ class ICToken: UIView {
104104
// MARK: - Private Methods
105105

106106
private func updateTextLabel() {
107-
var attributes = highlighted ? highlightedTextAttributes : normalTextAttributes
107+
var attributes = isHighlighted ? highlightedTextAttributes : normalTextAttributes
108108
if let color = attributes[NSBackgroundColorAttributeName] as? UIColor {
109109
textLabel.backgroundColor = color
110110
}

Source/TokenField/ICTokenField.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega
269269
// MARK: - UITextFieldDelegate
270270

271271
open func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
272-
tokens.forEach { $0.highlighted = false }
272+
tokens.forEach { $0.isHighlighted = false }
273273
return true
274274
}
275275

@@ -280,7 +280,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega
280280
open func textFieldDidEndEditing(_ textField: UITextField) {
281281
completeCurrentInputText()
282282
togglePlaceholderIfNeeded()
283-
tokens.forEach { $0.highlighted = false }
283+
tokens.forEach { $0.isHighlighted = false }
284284
delegate?.tokenFieldDidEndEditing?(self)
285285
}
286286

@@ -339,7 +339,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega
339339

340340
if let text = textField.text, text.isEmpty {
341341
textField.showsCursor = false
342-
tokens.last?.highlighted = true
342+
tokens.last?.isHighlighted = true
343343
}
344344
return true
345345
}
@@ -363,10 +363,10 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega
363363
for token in tokens {
364364
if token.frame.contains(touch) {
365365
scrollView.scrollRectToVisible(token.frame, animated: true)
366-
token.highlighted = true
366+
token.isHighlighted = true
367367
shouldFocusInputTextField = false
368368
} else {
369-
token.highlighted = false
369+
token.isHighlighted = false
370370
}
371371
}
372372

@@ -385,7 +385,7 @@ open class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelega
385385

386386
/// Returns true if any highlighted token is found and removed, otherwise false.
387387
private func removeHighlightedToken() -> Bool {
388-
for (index, token) in tokens.enumerated() where token.highlighted {
388+
for (index, token) in tokens.enumerated() where token.isHighlighted {
389389
tokens.remove(at: index)
390390
layoutTokenTextField()
391391
togglePlaceholderIfNeeded()

0 commit comments

Comments
 (0)