mirror of https://github.com/xaoxuu/ProHUD
update
This commit is contained in:
parent
6ac80334f6
commit
f33102e564
|
@ -63,13 +63,12 @@ public extension ProHUD {
|
||||||
/// - Parameter title: 标题
|
/// - Parameter title: 标题
|
||||||
/// - Parameter message: 内容
|
/// - Parameter message: 内容
|
||||||
/// - Parameter icon: 图标
|
/// - Parameter icon: 图标
|
||||||
public convenience init(scene: Scene = .default, title: String? = nil, message: String? = nil, icon: UIImage? = nil, actions: ((Alert) -> Void)? = nil) {
|
public convenience init(scene: Scene = .default, title: String? = nil, message: String? = nil, actions: ((Alert) -> Void)? = nil) {
|
||||||
self.init()
|
self.init()
|
||||||
vm.vc = self
|
vm.vc = self
|
||||||
vm.scene = scene
|
vm.scene = scene
|
||||||
vm.title = title
|
vm.title = title
|
||||||
vm.message = message
|
vm.message = message
|
||||||
vm.icon = icon
|
|
||||||
actions?(self)
|
actions?(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,11 @@ public extension Alert {
|
||||||
durationBlock?.cancel()
|
durationBlock?.cancel()
|
||||||
if let t = duration ?? scene.alertDuration, t > 0 {
|
if let t = duration ?? scene.alertDuration, t > 0 {
|
||||||
durationBlock = DispatchWorkItem(block: { [weak self] in
|
durationBlock = DispatchWorkItem(block: { [weak self] in
|
||||||
self?.vc?.pop()
|
if let vc = self?.vc {
|
||||||
|
if vc.buttonEvents.count == 0 {
|
||||||
|
vc.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
|
DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,7 +82,6 @@ public extension Alert.ViewModel {
|
||||||
/// - Parameter text: 标题
|
/// - Parameter text: 标题
|
||||||
/// - Parameter handler: 事件处理
|
/// - Parameter handler: 事件处理
|
||||||
@discardableResult func add(action style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton {
|
@discardableResult func add(action style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton {
|
||||||
duration = 0
|
|
||||||
return vc!.insert(action: nil, style: style, title: title, handler: handler)
|
return vc!.insert(action: nil, style: style, title: title, handler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +91,6 @@ public extension Alert.ViewModel {
|
||||||
/// - Parameter title: 标题
|
/// - Parameter title: 标题
|
||||||
/// - Parameter handler: 事件处理
|
/// - Parameter handler: 事件处理
|
||||||
@discardableResult func insert(action index: Int, style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton {
|
@discardableResult func insert(action index: Int, style: UIAlertAction.Style, title: String?, handler: (() -> Void)?) -> UIButton {
|
||||||
duration = 0
|
|
||||||
return vc!.insert(action: index, style: style, title: title, handler: handler)
|
return vc!.insert(action: index, style: style, title: title, handler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "ProHUDMinimize@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "ProHUDMinimize@3x.png",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"template-rendering-intent" : "original"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "ProHUDTrash@2x.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "ProHUDTrash@3x.png",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
|
@ -56,7 +56,11 @@ public extension Toast {
|
||||||
durationBlock?.cancel()
|
durationBlock?.cancel()
|
||||||
if let t = duration ?? scene.toastDuration, t > 0 {
|
if let t = duration ?? scene.toastDuration, t > 0 {
|
||||||
durationBlock = DispatchWorkItem(block: { [weak self] in
|
durationBlock = DispatchWorkItem(block: { [weak self] in
|
||||||
self?.vc?.pop()
|
if let vc = self?.vc {
|
||||||
|
if vc.buttonEvents.count == 0 {
|
||||||
|
vc.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
|
DispatchQueue.main.asyncAfter(deadline: .now()+t, execute: durationBlock!)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue