In my application the user can press a button. That in turn leads to a function call which is showed below:

**In ViewController.Swift**

```
@IBAction func pickMeUpButton(sender: AnyObject) {

    sendPushNotificationController().sendPushNotification("sendRequest",userInfo: defaults.stringForKey("x73")!, userInf23: defaults.stringForKey("x23")! )

    locationController.getLocationForShortTime() // --> here i want the timer to finish the 5 seconds before proceeding

    activityIndicator.center = self.view.center

    activityIndicator.startAnimating()

    self.view.addSubview(activityIndicator)

    //activityIndicator.stopAnimating()

}

```

And this is the class function where the call is being made to

**In getUserLocation.swift**

```
func initManager(){

    locationManager = CLLocationManager()
    locationManager.delegate = self
    locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.requestAlwaysAuthorization()
    locationManager.startUpdatingLocation()
}

func getLocationForShortTime(){

    initManager()
    timer = NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: "stopGettingLocation", userInfo: nil, repeats: false)

}

func stopGettingLocation(){

    locationManager.stopUpdatingLocation()
}

```

So this will make the application get the users location for 5 seconds and then the timer will stop the updates. What i want to do is when the five seconds has elapsed and the location update stops THEN i would like the calling function to proceed to next line. 

I though of some solutions using boolean, but it is not a nice solution. Im thinking there might be a better way to do this?