mirror of https://github.com/xaoxuu/ProHUD
loading
This commit is contained in:
parent
f5ec26f8fb
commit
ff28ddbdb1
|
@ -54,21 +54,18 @@ class DemoCapsuleVC: ListVC {
|
||||||
|
|
||||||
list.add(title: "默认布局:图文") { section in
|
list.add(title: "默认布局:图文") { section in
|
||||||
section.add(title: "短的消息") {
|
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: "下载进度") {
|
section.add(title: "下载进度") {
|
||||||
let capsule = CapsuleTarget()
|
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.update(progress: 0)
|
||||||
capsule.push()
|
capsule.push()
|
||||||
updateProgress(in: 4) { percent in
|
updateProgress(in: 4) { percent in
|
||||||
capsule.update(progress: percent)
|
capsule.update(progress: percent)
|
||||||
} completion: {
|
} completion: {
|
||||||
capsule.update { toast in
|
capsule.update { toast in
|
||||||
toast.vm = .message("下载成功")
|
toast.vm = .success(5).message("下载成功")
|
||||||
.icon(.init(systemName: "checkmark.circle.fill"))
|
|
||||||
.duration(5)
|
|
||||||
.tintColor(.systemGreen)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -198,12 +198,12 @@ public extension BaseViewModel {
|
||||||
static var loading: Self {
|
static var loading: Self {
|
||||||
.init()
|
.init()
|
||||||
.icon(.init(inProHUD: "prohud.windmill"))
|
.icon(.init(inProHUD: "prohud.windmill"))
|
||||||
.rotation(.default)
|
.rotation(.infinity)
|
||||||
}
|
}
|
||||||
static func loading(_ seconds: TimeInterval) -> Self {
|
static func loading(_ seconds: TimeInterval) -> Self {
|
||||||
.init()
|
.init()
|
||||||
.icon(.init(inProHUD: "prohud.windmill"))
|
.icon(.init(inProHUD: "prohud.windmill"))
|
||||||
.rotation(.default)
|
.rotation(.infinity)
|
||||||
.duration(seconds)
|
.duration(seconds)
|
||||||
}
|
}
|
||||||
// MARK: success
|
// MARK: success
|
||||||
|
|
|
@ -32,7 +32,7 @@ public struct Rotation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension Rotation {
|
public extension Rotation {
|
||||||
static var `default`: Self {
|
static var infinity: Self {
|
||||||
.init(direction: .clockwise, speed: 2, repeatCount: .infinity)
|
.init(direction: .clockwise, speed: 2, repeatCount: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
22
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/Contents.json
vendored
Normal file
22
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
BIN
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@2x.png
vendored
Normal file
BIN
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@3x.png
vendored
Normal file
BIN
Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue