ActivityIndicatorView
SwiftUI replacement for UIActivityIndicatorView
Install / Use
/learn @JoshHrach/ActivityIndicatorViewREADME
ActivityIndicatorView
A SwiftUI replacement for UIActivityIndicatorView
Note: Apple added ProgressView in iOS 14. It is suggested to use this directly; ActivityIndicatorView is thus no longer maintained.
Requirements
Version 1.x supports:
- Xcode 11.4+
- Swift 5.2+
- iOS 13.0+, macOS 10.15+, tvOS 13.0+, watchOS 6.0+
Installation
Install ActivityIndicatorView into your project using Swift Package Manager.
Usage
In your SwiftUI .swift file, add import ActivityIndicatorView.
To use, simply add the view where you would like it to appear.
// Example view
HStack {
// Your content
...
// Show indicator next to your content
ActivityIndicatorView()
}
Modifier
You can easily add an activity indicator to your view similar to how you would add an Alert or ActionSheet. This will overlay an activity indicator with a maximum frame size of 50 by 50. On iOS, this will appear similar to the default size of UIActivityIndicatorView. When overlaid over smaller views, the activity indicator will automatically resize smaller to fit the frame.
// Examples
// Add a default indicator.
.activityIndicator(isVisible: true)
// Add a custom indicator
.activityIndicator(isVisible: true) {
ActivityIndicatorView(foregroundColor: .green, backgroundColor: .black)
}
Appearance
Basic
You can add the view directly without customization. This will produce a view identical to UIActivityIndicatorView.
Custom
You can customize the view on initialization. By specifying a foregroundColor and backgroundColor, you can adapt the view for your application.
Support
Feel free to leave any feature requests or issues.
Contributing
If you'd like to contribute to improving this project, feel free to fork the project and create a pull request with your changes.
Author
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
