In swift, I always used the C notation like:
for (var i=0;i<mybuffer.count;i++) {}
Now in 3.0 this can not be used. The problem is that using
for i in..<mybuffer.count {}
will not check the value of mybuffer.count for each iteration, which leads to index out of range, in case the mybuffer.count changes.
Is there a way to overcome this?
I could use a while statement, but I guess that there must be a way to have a for in loop with a dynamic range, right?
mybufferas immutable, and creating a new array (using tools likemap). It is still possible to go the other way (and there are good reasons in some cases), but it stands out by requiringwhilesyntax.NSMutableArray. That would only be an issue with fast enumeration, not with a "normal"forloop.