how do you use removeTokenAtIndex
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?
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.
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.