Preload while synchronizing data in swift 2

0

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?

    
asked by Andres Guillermo Castellanos A 10.06.2016 в 16:05
source

2 answers

0
  • Third Party Bookstore

    E.j. NVActivityIndicatorView

  • 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
    
  • answered by 14.06.2016 в 01:51
    0

    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)
            }
        }
    
        
    answered by 12.09.2016 в 19:15