I have a list translated with J2Objc:
var userDtoIds:JavaUtilList = // some list
Now I want to iterate over this list with a for in
loop. I tried:
for iten in userDtoIds {
}
Error: Type 'JavaUtilList' does not conform to protocol 'SequenceType'
With:
let arr:IOSObjectArray = userDtoIds.toArray()
for iten in arr {
}
I got the Error: Type 'IOSObjectArray' does not conform to protocol 'SequenceType'
The only way how it works is:
for var i:Int32=0; i < userDtoIds.size(); i++ {
}
Can I use a for in
loop to iterate over a JavaUtilList?
Edit:
The following code leads to a runtime error:
var list = userDtoIds as! NSArray
for item:String in list as! [String] {
}