Andrea Culot Andrea Culot - 13 days ago 5
iOS Question

Is possible to get the current location with Firebase (iOS)?

I read all the docs and some examples of GeoFire for Firebase but I don't understand if it's possibile to get the current location of a user...is it possible? and if it is, how can I get it?

Answer

Geofire has a good readme at github...

Retrieving a location using Swift

geoFire.getLocationForKey("firebase-hq", withCallback: { (location, error) in
  if (error != nil) {
    println("An error occurred getting the location for \"firebase-hq\": \(error.localizedDescription)")
  } else if (location != nil) {
    println("Location for \"firebase-hq\" is [\(location.coordinate.latitude), \(location.coordinate.longitude)]")
  } else {
    println("GeoFire does not contain a location for \"firebase-hq\"")
  }
})

Take a look here and here!

Comments