udacity / ios-nd-networking

Resources for Udacity's iOS Networking with Swift course.
MIT License
173 stars 89 forks source link

Use spinner in the status bar for long running network requests. #10

Open OwenLaRosa opened 5 years ago

OwenLaRosa commented 5 years ago

We use a UIActivityIndicatorView on the login screen to signal network activity. Apps will also signal network activity for other types of long running tasks (like image downloads).

There's not always a place for an activity indicator view, but iOS does provide the same spinning animation in the status bar. You can enable it with

UIApplication.shared.isNetworkActivityIndicatorVisible = true

And disable it by setting the property to false.

For this task, try using a UIActivityIndicatorView or the one in the status bar, to signal in-progress network requests in another part of the app, like loading the image on the detail view..

aslangaslan commented 5 years ago

Is it right to handle this funcion in setLoggingIn in LoginViewController?

BrentMifsud commented 5 years ago

Is it right to handle this funcion in setLoggingIn in LoginViewController?

We already basically have this functionality in the LoginViewController when we added the activity spinner underneath the login buttons. He wants us to add it to the other view controllers where heavy network requests are being created.

Like the search view controller or the movie detail view controller when images are being downloaded.

However, if you do want to add the network indicator. Putting it inside the setLoggingIn would work.

BrentMifsud commented 5 years ago

If you are using an iPhone X, XS or XS max, the network activity indicator will never be visible.

This issue is only relevant to iPhone 8 and prior.