I am new to Swift and wanted to loop through an array of MKMapPoints which I get from an MKPolygon by calling myPoly.points(). However, I am stuck as to how to loop through every element of the C-Array of pointers.
for element in myPointsArray {}
does not work and I don't know how determine the number of elements of this kind of array in Swift. Any ideas? Thanks for your help!
UnsafeBufferPointer
presents an unsafe pointer and a count as a collection so you can for..in over it, subscript it safely, pass it to algorithms that work on collections etc:
for point in UnsafeBufferPointer(start: poly.points(), count: poly.pointCount) {
println("\(point.x),\(point.y)")
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments