I am using http communication in My iPhone app. I want to show a progress bar while it is loading data from server. How can I do it programmatically?
I just want a d
Translating @Hiren's answer to Swift
var indicator: UIActivityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
indicator.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
indicator.center = view.center
self.view.addSubview(indicator)
self.view.bringSubview(toFront: indicator)
UIApplication.shared.isNetworkActivityIndicatorVisible = true
Show indicator
indicator.startAnimating()
Stop indicator
indicator.stopAnimating()