I have got a massive and time-consuming routine (calculatePower) that needs a completion handler so that it behaves synchronously. The trigger for the request is a UIButton. It is called in:
func application(application: UIApplication!, performFetchWithCompletionHandler completionHandler: ((UIBackgroundFetchResult) -> Void)!) {
calculatePower() {
completionHandler(UIBackgroundFetchResult.NewData)
}
}
The important bits for the completion handler in calcualtePower reads as:
func calculatePower(completionHandler: (() -> Void)!) {
completionHandler()
}
Have I got this right and if so do I call application()?
application()
ain't it.