We are a development agency building phenomenal apps.
Create an indicator like this:
ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .default)
where
showLoadingIndicator
- bool value you may change to display or hide the indicator
type
- value from ActivityIndicatorView.IndicatorType
enum
You may alter it with standard SwiftUI means like this:
ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .default)
.frame(width: 50.0, height: 50.0)
.foregroundColor(.red)
Or specify another indicator type:
ActivityIndicatorView(isVisible: $showLoadingIndicator, type: .growingArc(.red, lineWidth: 4))
.frame(width: 50.0, height: 50.0)
Each indicator type has a number of parameters that have reasonable defaults. You can change them as you see fit, but it is advised to not set them too high or too low.
default
- iOS UIActivityIndicator style
.default(count: 8)
arcs
.arcs(count: 3, lineWidth: 2)
rotatingDots
.rotatingDots(count: 5)
flickeringDots
.flickeringDots(count: 8)
scalingDots
.scalingDots(count: 3, inset: 2)
opacityDots
.opacityDots(count: 3, inset: 4)
equalizer
.equalizer(count: 5)
growingArc
- add custom color for growing Arc, the default value is Color.black
.growingArc(.red, lineWidth: 4))
growingCircle
no parameters
gradient
- circle with angular gradient border stroke, pass colors ilke this:
.gradient([.white, .red], lineWidth: 4)
To try out the ActivityIndicatorView examples:
git clone git@github.com:exyte/ActivityIndicatorView.git
cd <ActivityIndicatorViewRepo>/Example
pod install
to install all dependenciesxed .
to open project in the Xcodepod 'ActivityIndicatorView'
github "Exyte/ActivityIndicatorView"
dependencies: [
.package(url: "https://github.com/exyte/ActivityIndicatorView.git", from: "0.0.1")
]
Drop ActivityIndicatorView.swift into your project.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。