nosyarg
nosyarg

Reputation: 156

function to execute whenever cllocationmanager updates location

I have a function in my CllocationManagerDelegate which I need to execute after my CllocationManager updates the location as soon as possible, but definitely not before. Is there any way to have a block of code execute as soon as the CllocationManager updates the location?

Upvotes: 0

Views: 67

Answers (1)

Hpennington
Hpennington

Reputation: 151

I would call your method, in the protocol method didUpdateLocations.

Like this:

func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {

   // update any CLLocation values
   // And then call the method with the code that you need to execute ASAP
   self.yourMethod()
}

Hope this helps!

Upvotes: 1

Related Questions