Swift 4: Show Network Activity Indicator

I sure am going to be unpopular, but I don’t get why an App is allowed to make “silent” network requests – in other words: I don’t get why the Network Indicator isn’t shown by the OS to alert users that there is network activity going on. However if you have a function, which makes a request, you can rather simply activate the Network Activity Indicator with the following line:

UIApplication.shared.isNetworkActivityIndicatorVisible = true

Beware, this line needs to run from the main thread! Also note, that you need to “manually” deactivate it by setting the same value to false

UIApplication.shared.isNetworkActivityIndicatorVisible = false

You obviously want to do this, to alert your users that something is going on!

Swift 4: Show Network Activity Indicator
Scroll to top