This commit is contained in:
xaoxuu 2023-08-24 13:19:56 +08:00
parent f5ec26f8fb
commit ff28ddbdb1
8 changed files with 28 additions and 9 deletions

View File

@ -54,21 +54,18 @@ class DemoCapsuleVC: ListVC {
list.add(title: "默认布局:图文") { section in
section.add(title: "短的消息") {
Capsule(.icon(.init(systemName: "checkmark.circle.fill")).title("成功"))
Capsule(.icon(.init(inProHUD: "prohud.rainbow.ring")).title("loading").rotation(.infinity))
}
section.add(title: "下载进度") {
let capsule = CapsuleTarget()
capsule.vm = .message("正在下载").icon(.init(systemName: "arrow.down.circle.fill")).duration(.infinity)
capsule.vm = .loading(.infinity).message("正在下载")
capsule.update(progress: 0)
capsule.push()
updateProgress(in: 4) { percent in
capsule.update(progress: percent)
} completion: {
capsule.update { toast in
toast.vm = .message("下载成功")
.icon(.init(systemName: "checkmark.circle.fill"))
.duration(5)
.tintColor(.systemGreen)
toast.vm = .success(5).message("下载成功")
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -198,12 +198,12 @@ public extension BaseViewModel {
static var loading: Self {
.init()
.icon(.init(inProHUD: "prohud.windmill"))
.rotation(.default)
.rotation(.infinity)
}
static func loading(_ seconds: TimeInterval) -> Self {
.init()
.icon(.init(inProHUD: "prohud.windmill"))
.rotation(.default)
.rotation(.infinity)
.duration(seconds)
}
// MARK: success

View File

@ -32,7 +32,7 @@ public struct Rotation {
}
public extension Rotation {
static var `default`: Self {
static var infinity: Self {
.init(direction: .clockwise, speed: 2, repeatCount: .infinity)
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "prohud.rainbow.ring@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "prohud.rainbow.ring@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB