Tony Merritt
Tony Merritt

Reputation: 1197

Progress bar update with on demand resources

Hi all I am trying to find out more info on getting the progress bar to work in swift. I just can't seem to find info on it that makes sense its either in Objective C or for TV.

below is the code I'm using to download the assists. any help would be appreciated.

 request = NSBundleResourceRequest(tags: [tag])
    request.beginAccessingResources { (error) in
        //  Called on background thread
        if error == nil {

            }
            OperationQueue.main.addOperation({ () -> Void in
               self.continueBtton.isEnabled = true
            })


        }
    }

Upvotes: 2

Views: 1130

Answers (1)

Dave Weston
Dave Weston

Reputation: 6635

When you create the request, do:

request = NSBundleResourceRequest(tags: [tag])
let progressView = UIProgressView()
progressView.observedProgress = request.progress
// add progressView to UI somehow

Then, when you enable the continueButton you can also remove the progressView.

Upvotes: 6

Related Questions