如何在Swift中循环mapView.Annotations?

时间:2014-12-07 01:16:02

标签: ios objective-c swift

无法将此系列Objective C代码转换为Swift

for (id <MKAnnotation> annotation in mapView.annotations) {
    // Do Something
}

当我尝试:

for (annotation:MKannotation in mapView.annotations)

OR

for (annotation in mapView.annotations)

我得到: 预期';'在“for”声明中

谢谢!

1 个答案:

答案 0 :(得分:10)

以下是答案:

for annotation in mapView.annotations as [MKAnnotation] {...}