โ† Back to list

SwiftUI Activity Indicator ๐Ÿ‘‡

I am assuming that you are aware with in UIActivityIndicatorView UIKit framework. Here, I will explain same activity indicator view byโ€ฆ

The Blue Prototype ยท 2020-11-09 09:40 ยท 41 claps ยท 1.4 min read paywalled
#swiftui #swift #ios #xcode #activity-indicator
Open on Medium โ†—
Wiki topics: ๐Ÿ“ฑ ยท Mobile Development

SwiftUI Activity Indicator ๐Ÿ‘‡

I am assuming that you are aware with in UIActivityIndicatorView UIKit framework. Here, I will explain same activity indicator view by SwiftUI framework.

Get Started

I hope, you have some basic knowledge on SwiftUI framework. So I am starting with activity indicator code.

In SwiftUI, there is โ€˜ProgressViewโ€™ view to draw activity loader. You can see in the below image. Now, I will play with its properties to make it more attractive.

In Depth

Now, I will draw simple activity indicator as you have seen in the top gif image.

  1. First created a View which returns the โ€˜ProgressViewโ€™ and takes two parameters โ€” tintColor & scaleSize. Where tintColor is the activity indicator color and scaleSize is to set the size of indicator. Here setting the โ€˜ProgressViewโ€™ style as โ€˜CircularProgressViewStyleโ€™ with tintColor.
  2. Then, in the body of ContentView, vertically, I added this LoaderView with a button. This button has action to show/hide the activity loader and simultaneously changing the text of button.
  3. I also done some other stuff. e.g. Created a View extension to show/hide a view in a smooth manner. Added some padding between LoaderView & Button.

Thatโ€™s done ๐Ÿ‘

Here is link of full source code: https://github.com/sanjeevworkstation/SwiftUIActivityIndicator

Thank You. Happy coding! ๐Ÿ‘

Enjoy some more my previous articles!

[embed]The Blue Prototype - Medium Read writing from The Blue Prototype on Medium. Tech Newsletter | https://www.linkedin.com/in/sanjeevkumargautam/โ€ฆtheblueprototype.medium.com


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
fedafb45bbaf
slug
swiftui-activity-indicator-fedafb45bbaf
url
https://medium.com/@theblueprototype/swiftui-activity-indicator-fedafb45bbaf
canonical_url
https://medium.com/@theblueprototype/swiftui-activity-indicator-fedafb45bbaf
author_url
https://medium.com/@theblueprototype
status
ok
fetched_at
2026-08-04 14:06:59