mirror of https://github.com/xaoxuu/ProHUD
update
This commit is contained in:
parent
29fa9f13c0
commit
4217c5a98c
|
@ -89,7 +89,8 @@ class TestToastVC: BaseListVC {
|
||||||
}
|
}
|
||||||
} else if row == 7 {
|
} else if row == 7 {
|
||||||
Toast.find("aaa", last: { (t) in
|
Toast.find("aaa", last: { (t) in
|
||||||
t.update { (vm) in
|
t.pulse()
|
||||||
|
t.update() { (vm) in
|
||||||
vm.title = "已经存在了"
|
vm.title = "已经存在了"
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ public extension ProHUD {
|
||||||
public var vm = ViewModel()
|
public var vm = ViewModel()
|
||||||
|
|
||||||
// MARK: 生命周期
|
// MARK: 生命周期
|
||||||
internal var isLoadFinished = false
|
private var isLoadFinished = false
|
||||||
|
|
||||||
/// 实例化
|
/// 实例化
|
||||||
/// - Parameter scene: 场景
|
/// - Parameter scene: 场景
|
||||||
|
@ -180,7 +180,7 @@ public extension Alert {
|
||||||
return Alert(scene: scene, title: title, message: message, actions: actions).push()
|
return Alert(scene: scene, title: title, message: message, actions: actions).push()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取指定的实例
|
/// 查找指定的实例
|
||||||
/// - Parameter identifier: 指定实例的标识
|
/// - Parameter identifier: 指定实例的标识
|
||||||
class func find(_ identifier: String?) -> [Alert] {
|
class func find(_ identifier: String?) -> [Alert] {
|
||||||
var aa = [Alert]()
|
var aa = [Alert]()
|
||||||
|
|
|
@ -49,7 +49,7 @@ public extension ProHUD {
|
||||||
public var isFullScreen = false
|
public var isFullScreen = false
|
||||||
|
|
||||||
/// 是否正在显示
|
/// 是否正在显示
|
||||||
private var displaying = false
|
private var isDisplaying = false
|
||||||
|
|
||||||
/// 背景颜色
|
/// 背景颜色
|
||||||
public var backgroundColor: UIColor? = UIColor(white: 0, alpha: 0.4)
|
public var backgroundColor: UIColor? = UIColor(white: 0, alpha: 0.4)
|
||||||
|
@ -57,7 +57,7 @@ public extension ProHUD {
|
||||||
public var vm = ViewModel()
|
public var vm = ViewModel()
|
||||||
|
|
||||||
// MARK: 生命周期
|
// MARK: 生命周期
|
||||||
internal var isLoadFinished = false
|
private var isLoadFinished = false
|
||||||
|
|
||||||
/// 实例化
|
/// 实例化
|
||||||
/// - Parameter title: 标题
|
/// - Parameter title: 标题
|
||||||
|
@ -106,10 +106,10 @@ public extension Guard {
|
||||||
view.snp.makeConstraints { (mk) in
|
view.snp.makeConstraints { (mk) in
|
||||||
mk.edges.equalToSuperview()
|
mk.edges.equalToSuperview()
|
||||||
}
|
}
|
||||||
if displaying == false {
|
if isDisplaying == false {
|
||||||
privTranslateOut()
|
privTranslateOut()
|
||||||
}
|
}
|
||||||
displaying = true
|
isDisplaying = true
|
||||||
UIView.animateForGuard {
|
UIView.animateForGuard {
|
||||||
self.privTranslateIn()
|
self.privTranslateIn()
|
||||||
}
|
}
|
||||||
|
@ -124,16 +124,16 @@ public extension Guard {
|
||||||
|
|
||||||
/// 从父视图控制器弹出
|
/// 从父视图控制器弹出
|
||||||
func pop() {
|
func pop() {
|
||||||
if displaying {
|
if isDisplaying {
|
||||||
debug("pop")
|
debug("pop")
|
||||||
willDisappearCallback?()
|
willDisappearCallback?()
|
||||||
displaying = false
|
isDisplaying = false
|
||||||
view.isUserInteractionEnabled = false
|
view.isUserInteractionEnabled = false
|
||||||
self.removeFromParent()
|
self.removeFromParent()
|
||||||
UIView.animateForGuard(animations: {
|
UIView.animateForGuard(animations: {
|
||||||
self.privTranslateOut()
|
self.privTranslateOut()
|
||||||
}) { (done) in
|
}) { (done) in
|
||||||
if self.displaying == false {
|
if self.isDisplaying == false {
|
||||||
self.view.removeFromSuperview()
|
self.view.removeFromSuperview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public extension Guard {
|
||||||
return Guard(actions: actions).push(to: viewController)
|
return Guard(actions: actions).push(to: viewController)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取指定的实例
|
/// 查找指定的实例
|
||||||
/// - Parameter identifier: 指定实例的标识
|
/// - Parameter identifier: 指定实例的标识
|
||||||
class func find(_ identifier: String?, from viewController: UIViewController? = nil) -> [Guard] {
|
class func find(_ identifier: String?, from viewController: UIViewController? = nil) -> [Guard] {
|
||||||
var gg = [Guard]()
|
var gg = [Guard]()
|
||||||
|
|
|
@ -173,6 +173,8 @@ public extension Toast {
|
||||||
vm.tapCallback = callback
|
vm.tapCallback = callback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 图片旋转效果
|
||||||
|
/// - Parameter rotate: 是否开启
|
||||||
func animate(rotate: Bool) {
|
func animate(rotate: Bool) {
|
||||||
if rotate {
|
if rotate {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
@ -187,6 +189,21 @@ public extension Toast {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 脉冲效果
|
||||||
|
func pulse() {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
UIView.animate(withDuration: 0.2, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: [.allowUserInteraction, .curveEaseOut], animations: {
|
||||||
|
self.window?.transform = .init(scaleX: 1.04, y: 1.04)
|
||||||
|
}) { (done) in
|
||||||
|
UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1, options: [.allowUserInteraction, .curveEaseIn], animations: {
|
||||||
|
self.window?.transform = .identity
|
||||||
|
}) { (done) in
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -202,7 +219,7 @@ public extension Toast {
|
||||||
return Toast(scene: scene, title: title, message: message, duration: duration, actions: actions).push()
|
return Toast(scene: scene, title: title, message: message, duration: duration, actions: actions).push()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 获取指定的toast
|
/// 查找指定的实例
|
||||||
/// - Parameter identifier: 标识
|
/// - Parameter identifier: 标识
|
||||||
class func find(_ identifier: String?) -> [Toast] {
|
class func find(_ identifier: String?) -> [Toast] {
|
||||||
var tt = [Toast]()
|
var tt = [Toast]()
|
||||||
|
|
Loading…
Reference in New Issue