@@ -84,7 +84,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
8484 }
8585 set {
8686 if let text = newValue {
87- attributedPlaceholder = AttributedString (
87+ attributedPlaceholder = NSAttributedString (
8888 string: text,
8989 attributes: [ NSForegroundColorAttributeName: UIColor ( red: 0.78 , green: 0.78 , blue: 0.80 , alpha: 0.9 ) ]
9090 )
@@ -97,7 +97,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
9797 // MARK: - UI Customization
9898
9999 /// The placeholder with customized attributes.
100- public var attributedPlaceholder : AttributedString ? {
100+ public var attributedPlaceholder : NSAttributedString ? {
101101 didSet {
102102 guard let attributedText = attributedPlaceholder else {
103103 placeholderLabel. text = nil
@@ -223,7 +223,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
223223
224224 // MARK: - UIResponder
225225
226- public override func isFirstResponder( ) -> Bool {
226+ public override var isFirstResponder : Bool {
227227 return inputTextField. isFirstResponder || super. isFirstResponder
228228 }
229229
@@ -279,12 +279,12 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
279279 }
280280
281281 public func textField( _ textField: UITextField , shouldChangeCharactersIn range: NSRange , replacementString string: String ) -> Bool {
282- removeHighlightedToken ( ) // as user starts typing when a token is focused
282+ _ = removeHighlightedToken ( ) // as user starts typing when a token is focused
283283 inputTextField. showsCursor = true
284284
285- guard let
286- input = textField. text,
287- text: NSString = ( input as NSString ) . replacingCharacters ( in: range, with: string)
285+ guard
286+ let input = textField. text,
287+ let text: NSString = ( input as NSString ) . replacingCharacters ( in: range, with: string)
288288 else {
289289 return true
290290 }
@@ -323,11 +323,11 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
323323 }
324324
325325 if !textField. showsCursor {
326- removeHighlightedToken ( )
326+ _ = removeHighlightedToken ( )
327327 return true
328328 }
329329
330- if let text = textField. text where text. isEmpty {
330+ if let text = textField. text, text. isEmpty {
331331 textField. showsCursor = false
332332 tokens. last? . highlighted = true
333333 }
@@ -342,7 +342,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
342342 }
343343
344344 @objc private func handleTapGesture( _ sender: UITapGestureRecognizer ) {
345- if !isFirstResponder( ) {
345+ if !isFirstResponder {
346346 inputTextField. becomeFirstResponder ( )
347347 }
348348
@@ -434,7 +434,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
434434
435435 /// Creates a token with the current input text.
436436 public func completeCurrentInputText( ) {
437- guard let text = inputTextField. text where !text. isEmpty else {
437+ guard let text = inputTextField. text, !text. isEmpty else {
438438 return
439439 }
440440 inputTextField. text = nil
0 commit comments