CLTokenInputView icon indicating copy to clipboard operation
CLTokenInputView copied to clipboard

how do you use removeTokenAtIndex

Open patthehuman opened this issue 9 years ago • 2 comments

im doing something like:

//remove all tokens let tokens = searchTypeView.tokens

    print("total tokens \(tokens.count)")

    for (i, v) in searchTypeView.tokens.enumerate() {
        print("remove toen \(i)")

        print(v)

        searchTypeView.removeToken(v)

    }

why does it crash?

patthehuman avatar Mar 22 '16 06:03 patthehuman

Hey @patthehuman,

What exactly are you trying to do? Also, do you mean the allTokens property, or are you somehow accessing the internal tokens array?

I tested this by enumerating allTokens, and then removing each one, and that seems to work for me. What's the crash error message you are getting? If you're manipulating the internal tokens array, then that would be a problem.

rsattar avatar Mar 23 '16 00:03 rsattar

Hey thanks for getting back to me. I really like CLTokenView.

I guess what I'm trying to do is remove all of the tokens without having to reinitialize the View.

my application is in Swift so my code is:

for (i, v) in searchTypeView.allTokens().enumerate() { searchTypeView.removeToken(v) }

Looks like nothing is getting removed, and there is no crash.

patthehuman avatar Mar 23 '16 03:03 patthehuman