@@ -37,6 +37,8 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate {
37
37
override func loadView( ) {
38
38
super. loadView ( )
39
39
view. backgroundColor = UIColor . white
40
+ textView. isEditable = false
41
+ textView. isSelectable = false
40
42
textView. text = " [ \n \n ] "
41
43
textView. font = UIFont . preferredFont ( forTextStyle: . subheadline)
42
44
textView. frame = view. bounds. insetBy ( dx: 10 , dy: 10 )
@@ -83,16 +85,29 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate {
83
85
print ( #function)
84
86
}
85
87
86
- func tokenField( _ tokenField: ICTokenField , didEnterText text: String ) {
87
- print ( " Add: \" \( text) \" " )
88
+ func tokenField( _ tokenField: ICTokenField , didChangeInputText text: String ) {
89
+ print ( " Typing \" \( text) \" " )
90
+ }
91
+
92
+ func tokenField( _ tokenField: ICTokenField , shouldCompleteText text: String ) -> Bool {
93
+ print ( " Should add \" \( text) \" ? " )
94
+ return text != " 42 "
95
+ }
96
+
97
+ func tokenField( _ tokenField: ICTokenField , didCompleteText text: String ) {
98
+ print ( " Added \" \( text) \" " )
88
99
updateTexts ( )
89
100
}
90
101
91
102
func tokenField( _ tokenField: ICTokenField , didDeleteText text: String , atIndex index: Int ) {
92
- print ( " Delete: \" \( text) \" " )
103
+ print ( " Deleted \" \( text) \" " )
93
104
updateTexts ( )
94
105
}
95
106
107
+ func tokenField( _ tokenField: ICTokenField , subsequentDelimiterForCompletedText text: String ) -> String {
108
+ return " , "
109
+ }
110
+
96
111
// MARK: - UIResponder Callbacks
97
112
98
113
@objc fileprivate func dismiss( _ sender: UIBarButtonItem ) {
0 commit comments