I am trying to save an object that contains a name string, an address string and location coordinates. In the docs it seems that there is one way to save firebase data and another way to save GeoFire data.
Firebase:
var alanisawesome = ["full_name": "Alan Turing", "date_of_birth": "June 23, 1912"]
var gracehop = ["full_name": "Grace Hopper", "date_of_birth": "December 9, 1906"]
var usersRef = ref.childByAppendingPath("users")
var users = ["alanisawesome": alanisawesome, "gracehop": gracehop]
usersRef.setValue(users)
GeoFire:
let geofireRef = Firebase(url: "https://<your-firebase>.firebaseio.com/")
let geoFire = GeoFire(firebaseRef: geofireRef)
geoFire.setLocation(CLLocation(latitude: 37.7853889, longitude: -122.4056973), forKey: "firebase-hq") { (error) in
if (error != nil) {
println("An error occured: \(error)")
} else {
println("Saved location successfully!")
}
}
Is it possible to save both location and other data in the same request? I'd like to do it in the same request because I don't want the user to be able to create an object without location data if the location request fails. Or is there another smart way to impose that restriction?