VHUD
简单的 HUD。
VHUD 受 PKHUD 的启发。
示例
显示
import VHUD
func example() {
var content = VHUDContent(.loop(3.0))
content.loadingText = "Loading.."
content.completionText = "Finish!"
VHUD.show(content)
}
关闭
// duration, deley(Option), text(Option), completion(Option)
VHUD.dismiss(1.0, 1.0)
模式
- 循环
- 持续时间
- 完成百分比
自定义
形状
- 圆形
var content = VHUDContent(.loop(3.0))
content.shape = .circle
VHUD.show(content)
- 圆形的
var content = VHUDContent(.loop(3.0))
content.shape = .round
VHUD.show(content)
自定义 (使用闭包)
样式
- 明亮
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .light
VHUD.show(content)
- 深色
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .dark
VHUD.show(content)
- 模糊
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .blur(.light)
VHUD.show(content)
背景
- 无
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .blur(.light)
content.background = .none
VHUD.show(content)
- 颜色
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .dark
content.background = .color(#colorLiteral(red: 0.937254902, green: 0.937254902, blue: 0.9568627451, alpha: 0.7))
VHUD.show(content)
- 模糊
var content = VHUDContent(.loop(3.0))
content.shape = .circle
content.style = .light
content.background = .blur(.dark)
VHUD.show(content)
要求
- Xcode 10+
操作系统 | Swift | |
---|---|---|
v1.1.x | iOS 8+ | 3.0 |
v1.2.x | iOS 8+ | 3.2 |
v1.3.x | iOS 9+ | 4.1 |
v1.4.x | iOS 9+ | 4.2 |
v1.5.x | iOS 10+ | 5.0 |
安装
CocoaPods
您可以使用 CocoaPods 通过将其添加到您的 Podfile
中安装 VHUD
use_frameworks!
pod 'VHUD'
要获取全部功能,请将 VHUD
导入到您导入 UIKit 的任何地方
import UIKit
import VHUD
Carthage
您可以使用 Carthage,通过将其添加到您的 Cartfile
中来安装 VHUD
github "xxxAIRINxxx/VHUD"
要获取全部功能,请将 VHUD
导入到您导入 UIKit 的任何地方
import UIKit
import VHUD
手动
- 下载并将
/Sources
文件夹拖入您的项目中。 - 恭喜!
许可协议
MIT 许可协议。更多信息请参阅 LICENSE 文件。