I am getting data from a REST API with Swift 2 and I need a preload to be displayed while loading the information.
How can I do it?
I am getting data from a REST API with Swift 2 and I need a preload to be displayed while loading the information.
How can I do it?
Third Party Bookstore
Place a UIActivityIndicatorView
above the view when there is a call.
The Network Activity Indicator
Usage:
// Mostrar
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
// Ocultar
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
You could use Alamofire: link
And while downloading the information add a UIProgressView in your view and when you finish you change the view:
Here is an example of the Alamofire page.
Alamofire.download("https://httpbin.org/image/png")
.downloadProgress { progress in
print("Download Progress: \(progress.fractionCompleted)")
}
.responseData { response in
if let data = response.result.value {
let image = UIImage(data: data)
}
}