Swift Loading Screen

Hello friends, in this article, we will talk about how we can create a common waiting screen with Swift in our iOS projects. Actually, there are many ways to do this. These;

  • Using a pod
  • Writing extension to UIView
  • Writing a class

Using Pod

Using a pod for the loading screen is one of the simplest and easiest ways. The pod we use the most for this job is SVProgressHud. You can view it here. You can simply load loading on your screen. Its output is as follows.

Writing Extension to UIView

This is one of the most logical ways if you want to put a separate view yourself here. Here, when you call the showLoading function in the View at the top of your ViewController, you will see a Loading icon with a blurred backside.

The screen output is as follows.

Writing Class

Another method we use is to create a class, define it with a static variable and display it at the top layer of the screen. Just write the code below for this.

After that, just run the following line of code where you want to use it.

You can reach the project here. If you have questions, you can ask by mail or comment. Good work.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.