View doesn't appear before time consuming operation
<p>I've implemented this indicator in my app: <a href="https://github.com/vincechan/SwiftLoadingIndicator" rel="nofollow">https://github.com/vincechan/SwiftLoadingIndicator</a></p>

<p>Right after this loading spinner comes to front, I want it to spin all the time, for as long as my operation lasts.</p>

<p>In my operation I do some work on images and then show them to the user, but everytime after I click the "run operation" button, app freezes for a few seconds, updates view with the results and then shows the overlay spinner.
I've tried async dispatch like this:</p>

<pre><code> @IBAction func manipulateImage(sender: AnyObject) {
    dispatch_async(dispatch_get_main_queue(), {
                    LoadingOverlayView.show()
                }); 
       if let beginImage = CIImage(image: self.imageView.image!) {
                    var outputImage = OutputImage(sourceImage: beginImage)
    //apply CIFilters:
                    outputImage.applyFilter(FilterType.Grayscale)
                    outputImage.applyFilter(FilterType.Sepia)
                    outputImage.applyFilter(FilterType.Vignette)
                    outputImage.applyFilter(FilterType.Shadow)

                    let cgimg = self.imageContext.createCGImage(outputImage, fromRect: outputImage.extent)

                    self.imageView.image = UIImage(CGImage: cgimg)
    LoadingOverlayView.hide()
}
</code></pre>

<p>but it doesn't work. Also normal method calls, without async dispatch, acts exactly the same.</p>