diff --git a/PHDemo/PHDemo/DemoCapsuleVC.swift b/PHDemo/PHDemo/DemoCapsuleVC.swift index 5f76637..b3511aa 100644 --- a/PHDemo/PHDemo/DemoCapsuleVC.swift +++ b/PHDemo/PHDemo/DemoCapsuleVC.swift @@ -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("下载成功") } } } diff --git a/Resources/prohud.rainbow.ring@2x.png b/Resources/prohud.rainbow.ring@2x.png new file mode 100644 index 0000000..51fdd40 Binary files /dev/null and b/Resources/prohud.rainbow.ring@2x.png differ diff --git a/Resources/prohud.rainbow.ring@3x.png b/Resources/prohud.rainbow.ring@3x.png new file mode 100644 index 0000000..d6d457b Binary files /dev/null and b/Resources/prohud.rainbow.ring@3x.png differ diff --git a/Sources/ProHUD/Core/Models/BaseViewModel.swift b/Sources/ProHUD/Core/Models/BaseViewModel.swift index 37fb9ae..fe4ab77 100644 --- a/Sources/ProHUD/Core/Models/BaseViewModel.swift +++ b/Sources/ProHUD/Core/Models/BaseViewModel.swift @@ -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 diff --git a/Sources/ProHUD/Core/Models/Rotation.swift b/Sources/ProHUD/Core/Models/Rotation.swift index db21c21..9ede3c9 100644 --- a/Sources/ProHUD/Core/Models/Rotation.swift +++ b/Sources/ProHUD/Core/Models/Rotation.swift @@ -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) } } diff --git a/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/Contents.json b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/Contents.json new file mode 100644 index 0000000..76253c0 --- /dev/null +++ b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/Contents.json @@ -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 + } +} diff --git a/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@2x.png b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@2x.png new file mode 100644 index 0000000..51fdd40 Binary files /dev/null and b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@2x.png differ diff --git a/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@3x.png b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@3x.png new file mode 100644 index 0000000..d6d457b Binary files /dev/null and b/Sources/ProHUD/Resources/ProHUD.xcassets/prohud.rainbow.ring.imageset/prohud.rainbow.ring@3x.png differ