像这样创建一个进度指示器:
ProgressIndicatorView(isVisible: $showProgressIndicator, type: .bar(progress: $progress))
其中:
showProgressIndicator
- 一个布尔值,您可以更改它来显示或隐藏指示器。
type
- 来自 ProgressIndicatorView.IndicatorType
枚举的值。
您可以使用标准的 SwiftUI 方法来修改它,例如这样:
ProgressIndicatorView(isVisible: $showProgressIndicator, type: .bar(progress: $progress))
.frame(width: 50.0, height: 50.0)
.foregroundColor(.red)
default
- 进度指示器看起来像默认的 iOS UIActivityIndicator。
bar
- 带有 Binding 进度值和背景颜色的线性进度条,默认颜色为 Color.clear
。
ProgressIndicatorView(isVisible: $showProgressIndicator, type: .bar(progress: $progress, backgroundColor: .gray)
.frame(height: 8.0)
.foregroundColor(.red)
impulseBar
- 脉冲线性条,与 bar
指示器类似,但带有脉冲效果。
dashBar
- 离散线性条,带有多个片段,默认值为 8。
ProgressIndicatorView(isVisible: $showProgressIndicator, type: .dashBar(progress: $progress, numberOfItems: 8))
.frame(height: 8.0)
.foregroundColor(.red)
circle
- 圆形进度指示器,带有 lineWidth
和 strokeColor
。
ProgressIndicatorView(isVisible: $showProgressIndicator, type: .circle(progress: $progress, lineWidth: 8.0, strokeColor: .red))
.frame(height: 8.0)
.foregroundColor(.red)
要尝试 ProgressIndicatorView 示例:
git clone git@github.com:exyte/ProgressIndicatorView.git
cd <ProgressIndicatorViewRepo>/Example
pod install
来安装所有依赖项xed .
以在 Xcode 中打开项目dependencies: [
.package(url: "https://github.com/exyte/ProgressIndicatorView.git", from: "0.0.1")
]
pod 'ProgressIndicatorView'
github "Exyte/ProgressIndicatorView"
PopupView - Toasts 和 popups 库
Grid - 最强大的 Grid 容器
ScalingHeaderScrollView - 带有粘性标题的滚动视图,当您滚动时标题会缩小
AnimatedTabBar - 带有多个预设动画的标签栏
MediaPicker - 可自定义的媒体选择器
Chat - 聊天 UI 框架,具有完全可自定义的消息单元格、输入视图和内置的媒体选择器
OpenAI - OpenAI REST API 的包装库
AnimatedGradient - 动画线性渐变
ConcentricOnboarding - 动画引导流程
FloatingButton - 浮动按钮菜单
ActivityIndicatorView - 一系列动画加载指示器
FlagAndCountryCode - 每个国家的电话代码和标志
SVGView - SVG 解析器
LiquidSwipe - 流动导航动画