mirror of https://github.com/xaoxuu/ProHUD
支持继承,可以设置条件显示
This commit is contained in:
parent
1d4465b496
commit
320e4db560
|
@ -3,7 +3,7 @@
|
||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 55;
|
objectVersion = 60;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
CDA83DB928C601E60025F0DF /* TableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA83DB828C601E60025F0DF /* TableHeaderView.swift */; };
|
CDA83DB928C601E60025F0DF /* TableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA83DB828C601E60025F0DF /* TableHeaderView.swift */; };
|
||||||
CDB6A2A228BC5F4600DEC80D /* ProHUD in Frameworks */ = {isa = PBXBuildFile; productRef = CDB6A2A128BC5F4600DEC80D /* ProHUD */; };
|
CDB6A2A228BC5F4600DEC80D /* ProHUD in Frameworks */ = {isa = PBXBuildFile; productRef = CDB6A2A128BC5F4600DEC80D /* ProHUD */; };
|
||||||
CDB7A1D028C32A7400E034D8 /* AlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB7A1CF28C32A7400E034D8 /* AlertVC.swift */; };
|
CDB7A1D028C32A7400E034D8 /* AlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB7A1CF28C32A7400E034D8 /* AlertVC.swift */; };
|
||||||
|
CDCBAEC42A80D6FD00C30DE5 /* ProHUD in Frameworks */ = {isa = PBXBuildFile; productRef = CDCBAEC32A80D6FD00C30DE5 /* ProHUD */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
@ -38,7 +39,6 @@
|
||||||
CD8EEF4828BC5C7300E660EA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
CD8EEF4828BC5C7300E660EA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
CD9C7B1D28CB8972006190CD /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
CD9C7B1D28CB8972006190CD /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
||||||
CDA83DB828C601E60025F0DF /* TableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableHeaderView.swift; sourceTree = "<group>"; };
|
CDA83DB828C601E60025F0DF /* TableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableHeaderView.swift; sourceTree = "<group>"; };
|
||||||
CDB6A29F28BC5F0F00DEC80D /* ProHUD */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = ProHUD; path = ..; sourceTree = "<group>"; };
|
|
||||||
CDB7A1CF28C32A7400E034D8 /* AlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertVC.swift; sourceTree = "<group>"; };
|
CDB7A1CF28C32A7400E034D8 /* AlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertVC.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
CDCBAEC42A80D6FD00C30DE5 /* ProHUD in Frameworks */,
|
||||||
CD891BCD2A80B58E00848BBC /* SnapKit in Frameworks */,
|
CD891BCD2A80B58E00848BBC /* SnapKit in Frameworks */,
|
||||||
CDB6A2A228BC5F4600DEC80D /* ProHUD in Frameworks */,
|
CDB6A2A228BC5F4600DEC80D /* ProHUD in Frameworks */,
|
||||||
CD6AE8A32A7CC1BA0044E53D /* SnapKit in Frameworks */,
|
CD6AE8A32A7CC1BA0044E53D /* SnapKit in Frameworks */,
|
||||||
|
@ -59,7 +60,6 @@
|
||||||
CD8EEF2E28BC5C7200E660EA = {
|
CD8EEF2E28BC5C7200E660EA = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
CDB6A29E28BC5F0F00DEC80D /* Packages */,
|
|
||||||
CD8EEF3928BC5C7200E660EA /* PHDemo */,
|
CD8EEF3928BC5C7200E660EA /* PHDemo */,
|
||||||
CD8EEF3828BC5C7200E660EA /* Products */,
|
CD8EEF3828BC5C7200E660EA /* Products */,
|
||||||
CDB6A2A028BC5F4600DEC80D /* Frameworks */,
|
CDB6A2A028BC5F4600DEC80D /* Frameworks */,
|
||||||
|
@ -94,14 +94,6 @@
|
||||||
path = PHDemo;
|
path = PHDemo;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
CDB6A29E28BC5F0F00DEC80D /* Packages */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
CDB6A29F28BC5F0F00DEC80D /* ProHUD */,
|
|
||||||
);
|
|
||||||
name = Packages;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
CDB6A2A028BC5F4600DEC80D /* Frameworks */ = {
|
CDB6A2A028BC5F4600DEC80D /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -129,6 +121,7 @@
|
||||||
CDB6A2A128BC5F4600DEC80D /* ProHUD */,
|
CDB6A2A128BC5F4600DEC80D /* ProHUD */,
|
||||||
CD6AE8A22A7CC1BA0044E53D /* SnapKit */,
|
CD6AE8A22A7CC1BA0044E53D /* SnapKit */,
|
||||||
CD891BCC2A80B58E00848BBC /* SnapKit */,
|
CD891BCC2A80B58E00848BBC /* SnapKit */,
|
||||||
|
CDCBAEC32A80D6FD00C30DE5 /* ProHUD */,
|
||||||
);
|
);
|
||||||
productName = PHDemo;
|
productName = PHDemo;
|
||||||
productReference = CD8EEF3728BC5C7200E660EA /* PHDemo.app */;
|
productReference = CD8EEF3728BC5C7200E660EA /* PHDemo.app */;
|
||||||
|
@ -160,6 +153,7 @@
|
||||||
mainGroup = CD8EEF2E28BC5C7200E660EA;
|
mainGroup = CD8EEF2E28BC5C7200E660EA;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
CD891BCB2A80B58E00848BBC /* XCRemoteSwiftPackageReference "SnapKit" */,
|
CD891BCB2A80B58E00848BBC /* XCRemoteSwiftPackageReference "SnapKit" */,
|
||||||
|
CDCBAEC22A80D6FD00C30DE5 /* XCLocalSwiftPackageReference ".." */,
|
||||||
);
|
);
|
||||||
productRefGroup = CD8EEF3828BC5C7200E660EA /* Products */;
|
productRefGroup = CD8EEF3828BC5C7200E660EA /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
@ -417,6 +411,13 @@
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCLocalSwiftPackageReference section */
|
||||||
|
CDCBAEC22A80D6FD00C30DE5 /* XCLocalSwiftPackageReference ".." */ = {
|
||||||
|
isa = XCLocalSwiftPackageReference;
|
||||||
|
relativePath = ..;
|
||||||
|
};
|
||||||
|
/* End XCLocalSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCRemoteSwiftPackageReference section */
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
CD891BCB2A80B58E00848BBC /* XCRemoteSwiftPackageReference "SnapKit" */ = {
|
CD891BCB2A80B58E00848BBC /* XCRemoteSwiftPackageReference "SnapKit" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
@ -442,6 +443,10 @@
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = ProHUD;
|
productName = ProHUD;
|
||||||
};
|
};
|
||||||
|
CDCBAEC32A80D6FD00C30DE5 /* ProHUD */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
productName = ProHUD;
|
||||||
|
};
|
||||||
/* End XCSwiftPackageProductDependency section */
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = CD8EEF2F28BC5C7200E660EA /* Project object */;
|
rootObject = CD8EEF2F28BC5C7200E660EA /* Project object */;
|
||||||
|
|
|
@ -30,6 +30,17 @@ func updateProgress(in duration: TimeInterval, callback: @escaping (_ percent: C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isTesting: Bool = false
|
||||||
|
|
||||||
|
class TestToast: Toast {
|
||||||
|
override func push() {
|
||||||
|
guard isTesting else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
super.push()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class ToastVC: ListVC {
|
class ToastVC: ListVC {
|
||||||
|
|
||||||
|
@ -53,7 +64,7 @@ class ToastVC: ListVC {
|
||||||
|
|
||||||
list.add(title: "默认布局") { section in
|
list.add(title: "默认布局") { section in
|
||||||
section.add(title: "标题 + 正文") {
|
section.add(title: "标题 + 正文") {
|
||||||
Toast(.title(title).message(message)).push()
|
TestToast(.title(title).message(message)).push()
|
||||||
}
|
}
|
||||||
section.add(title: "一段长文本") {
|
section.add(title: "一段长文本") {
|
||||||
Toast(.message(message)).push()
|
Toast(.message(message)).push()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class Alert: ProHUD.Controller {
|
open class Alert: ProHUD.Controller {
|
||||||
|
|
||||||
public lazy var config: Configuration = {
|
public lazy var config: Configuration = {
|
||||||
var cfg = Configuration()
|
var cfg = Configuration()
|
||||||
|
@ -107,7 +107,7 @@ public class Alert: ProHUD.Controller {
|
||||||
navEvents[.onViewDidLoad]?(self)
|
navEvents[.onViewDidLoad]?(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required public init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,9 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension Alert: HUD {
|
extension Alert: HUD {
|
||||||
public func push(scene: UIWindowScene?) {
|
|
||||||
push()
|
@objc open func push() {
|
||||||
}
|
guard Configuration.isEnabled else { return }
|
||||||
public func push() {
|
|
||||||
let window = createAttachedWindowIfNotExists()
|
let window = createAttachedWindowIfNotExists()
|
||||||
guard window.alerts.contains(self) == false else {
|
guard window.alerts.contains(self) == false else {
|
||||||
return
|
return
|
||||||
|
@ -38,7 +37,7 @@ extension Alert: HUD {
|
||||||
Alert.updateAlertsLayout(alerts: window.alerts)
|
Alert.updateAlertsLayout(alerts: window.alerts)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func pop() {
|
@objc open func pop() {
|
||||||
navEvents[.onViewWillDisappear]?(self)
|
navEvents[.onViewWillDisappear]?(self)
|
||||||
let window = window ?? createAttachedWindowIfNotExists()
|
let window = window ?? createAttachedWindowIfNotExists()
|
||||||
Alert.removeAlert(alert: self)
|
Alert.removeAlert(alert: self)
|
||||||
|
|
|
@ -9,6 +9,9 @@ import UIKit
|
||||||
|
|
||||||
public class Configuration: NSObject {
|
public class Configuration: NSObject {
|
||||||
|
|
||||||
|
/// 全局功能开关
|
||||||
|
public static var isEnabled: Bool = true
|
||||||
|
|
||||||
/// 是否允许log输出
|
/// 是否允许log输出
|
||||||
public static var enablePrint = true
|
public static var enablePrint = true
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,14 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public protocol HUD {
|
@objc public protocol HUD {
|
||||||
func push()
|
@objc func push()
|
||||||
func push(workspace: Workspace?)
|
@objc func pop()
|
||||||
func pop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension HUD {
|
//public extension HUD {
|
||||||
func push(workspace: Workspace?) {
|
// func push(workspace: Workspace?) {
|
||||||
AppContext.workspace = workspace
|
// AppContext.workspace = workspace
|
||||||
push()
|
// push()
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class Sheet: Controller {
|
open class Sheet: Controller {
|
||||||
|
|
||||||
weak var window: SheetWindow?
|
weak var window: SheetWindow?
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,12 @@ import UIKit
|
||||||
|
|
||||||
extension Sheet: HUD {
|
extension Sheet: HUD {
|
||||||
|
|
||||||
public func push() {
|
@objc open func push() {
|
||||||
|
guard Configuration.isEnabled else { return }
|
||||||
SheetWindow.push(sheet: self)
|
SheetWindow.push(sheet: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func pop() {
|
@objc open func pop() {
|
||||||
SheetWindow.pop(sheet: self)
|
SheetWindow.pop(sheet: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class Toast: Controller {
|
open class Toast: Controller {
|
||||||
|
|
||||||
weak var window: ToastWindow?
|
weak var window: ToastWindow?
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,12 @@ import UIKit
|
||||||
|
|
||||||
extension Toast: HUD {
|
extension Toast: HUD {
|
||||||
|
|
||||||
public func push() {
|
@objc open func push() {
|
||||||
|
guard Configuration.isEnabled else { return }
|
||||||
ToastWindow.push(toast: self)
|
ToastWindow.push(toast: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func pop() {
|
@objc open func pop() {
|
||||||
ToastWindow.pop(toast: self)
|
ToastWindow.pop(toast: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue