我有一个内置一些元组的数组.如何在数组中获得该元组的第一项?
let cars = [("cars","cycles"),("stairs","escalator"),("table","chair")]
Run Code Online (Sandbox Code Playgroud)
我想得到每个元组中的第一项结果应该是"汽车","楼梯","桌子"
如何设置下面的数组.我试图在我的地图上添加多个注释.我能够在stackoverflow上找到下面的代码,但是他们没有展示如何设置数组.
var objects = [
//how should the array be setup here
]
for objecters in objects!{
if let latit = objecters["Coordinates"]["Latitude"]{
self.latitudepoint = latit as! String
self.map.reloadInputViews()
}
else {
continue
}
if let longi = objecters["Coordinates"]["Longitude"]{
self.longitudepoint = longi as! String
self.map.reloadInputViews()
}
else {
continue
}
var annotation = MKPointAnnotation()
var coord = CLLocationCoordinate2D(latitude: Double(self.latitudepoint)!,longitude: Double(self.longitudepoint)!)
mapView.addAnnotation(annotation)
}
Run Code Online (Sandbox Code Playgroud)