How to show the loading indicator in the top status bar

It's in UIApplication:

For Objective C:

Start:

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

End:

[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

For swift :

Start

UIApplication.shared.isNetworkActivityIndicatorVisible = true

End

UIApplication.shared.isNetworkActivityIndicatorVisible = false

I've found the following macros pretty useful!

#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO

So you can just call ShowNetworkActivityIndicator(); or HideNetworkActivityIndicator(); from within your app (as long as the header is included of course!).