let washingtonRef = db.collection("cities").document("DC")
// Atomically add a new region to the "regions" array field.
washingtonRef.updateData([
"regions": FieldValue.arrayUnion(["greater_virginia"])
])
// Atomically remove a region from the "regions" array field.
washingtonRef.updateData([
"regions": FieldValue.arrayRemove(["east_coast"])
])
Google Map에서 마커나 마커 정보뷰를 클릭했을 때 이벤트 설정
class MapViewController: UIViewController, CLLocationManagerDelegate, GMSMapViewDelegate
mapView?.delegate = self
3.1 마커 정보 클릭 이벤트
func mapView(_ mapView: GMSMapView, didTapInfoWindowOf marker: GMSMarker) {
code
}
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
code
return true
}
마커 클릭으로 데이터를 다른 뷰에 넘기기 애매했는데 Segue로 넘길 수 있는 방법 발견
ViewController에서 ViewController로 Segue를 연결한 뒤 segue identifier에 이름을 부여하고
self.performSegue(withIdentifier: "sgMapInfo", sender: self)
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
if segue.identifier == "sgMapInfo"{
let infoView = segue.destination as! PlaceInfoTableViewController
let i = places.first(where: {$0.name == placeTitle})
infoView.getInfo(i!, image: placeImages[(i?.name!)!]!)
}
}