From d182b5fede153f2d9653a1ec95dc1e6b66ea91fc Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 5 Aug 2019 20:13:17 +0800 Subject: [PATCH] update --- Example/Example/ViewController.swift | 14 ++-- Podfile | 14 ++++ Podfile.lock | 19 +++++ ProHUD.xcodeproj/project.pbxproj | 72 +++++++++++++++++++ ProHUD.xcworkspace/contents.xcworkspacedata | 10 +++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ ProHUD/Alert/AlertModel.swift | 2 + ProHUD/Guard/GuardController.swift | 2 +- ProHUD/HUDConfig.swift | 1 + ProHUD/HUDView.swift | 24 ------- ProHUD/ProHUD.swift | 1 + ProHUD/Toast/ToastController.swift | 2 +- ProHUD/Toast/ToastModel.swift | 2 + 13 files changed, 141 insertions(+), 30 deletions(-) create mode 100644 Podfile create mode 100644 Podfile.lock create mode 100644 ProHUD.xcworkspace/contents.xcworkspacedata create mode 100644 ProHUD.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 85a9b7f..9df51f8 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -33,8 +33,8 @@ class ViewController: UIViewController { // testUpdateAction() -// testGuard() - fastGuard() + testGuard() +// fastGuard() } func testDelete() { @@ -86,7 +86,7 @@ class ViewController: UIViewController { g.add(action: .destructive, title: "测试删除弹窗", action: { [weak self] in self?.testDelete() }) - g.add(action: .cancel, title: "我知道了") + g.add(action: .cancel, title: "我知道了", action: nil) g.push(to: self) debugPrint("test: ", g) @@ -103,9 +103,15 @@ class ViewController: UIViewController { } func fastGuard() { - ProHUD.push(guard: self, title: "测试", message: "测试测试").add(action: .cancel, title: "OK", action: { + let g = ProHUD.push(guard: self, title: "测试", message: "测试测试") + g.add(action: .default, title: "默认按钮", action: { }) + g.add(action: .cancel, title: "取消", action: nil) + g.view.backgroundColor = .clear + +// g.contentView.backgroundColor = UIColor.white + } diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..cd0ee40 --- /dev/null +++ b/Podfile @@ -0,0 +1,14 @@ +platform :ios, '10.0' +use_frameworks! + +target 'ProHUD' do + + pod 'SnapKit', '4.2.0' + pod 'Inspire', :path => '../Inspire' + +end + + + +#pod install --verbose --no-repo-update #安装命令 +#pod update --verbose --no-repo-update #更新命令 diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..fe21848 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,19 @@ +PODS: + - Inspire (1.0.5) + - SnapKit (4.2.0) + +DEPENDENCIES: + - Inspire (from `../Inspire`) + - SnapKit (= 4.2.0) + +EXTERNAL SOURCES: + Inspire: + :path: ../Inspire + +SPEC CHECKSUMS: + Inspire: a213962fa02d0c4b8e27e389318ff4b47e4565ed + SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a + +PODFILE CHECKSUM: aacd299b22fe3d0cf28b81c1e2931b02b66a7963 + +COCOAPODS: 1.3.1 diff --git a/ProHUD.xcodeproj/project.pbxproj b/ProHUD.xcodeproj/project.pbxproj index 63c5ecc..dde47e4 100644 --- a/ProHUD.xcodeproj/project.pbxproj +++ b/ProHUD.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1AE9C44ABAF3F797A5518CE8 /* Pods_ProHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2011798511AD590A613E54E /* Pods_ProHUD.framework */; }; CD16490B22EF09AB0077988C /* AlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490A22EF09AB0077988C /* AlertModel.swift */; }; CD16490D22EF09B40077988C /* AlertConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490C22EF09B40077988C /* AlertConfig.swift */; }; CD16490F22EF09D50077988C /* AlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490E22EF09D50077988C /* AlertView.swift */; }; @@ -27,6 +28,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 3C95FD2F17A45D13E2AB9306 /* Pods-ProHUD.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProHUD.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ProHUD/Pods-ProHUD.debug.xcconfig"; sourceTree = ""; }; + C2011798511AD590A613E54E /* Pods_ProHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ProHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CD16490A22EF09AB0077988C /* AlertModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertModel.swift; sourceTree = ""; }; CD16490C22EF09B40077988C /* AlertConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertConfig.swift; sourceTree = ""; }; CD16490E22EF09D50077988C /* AlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertView.swift; sourceTree = ""; }; @@ -47,6 +50,7 @@ CD95D26A22E72DB3007559A3 /* ProHUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProHUD.swift; sourceTree = ""; }; CDB6A07A22EEF06500AF6CF0 /* HUDController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDController.swift; sourceTree = ""; }; CDB6A07C22EEF19D00AF6CF0 /* HUDConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDConfig.swift; sourceTree = ""; }; + DC31EBFAC56868D6096A233A /* Pods-ProHUD.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProHUD.release.xcconfig"; path = "Pods/Target Support Files/Pods-ProHUD/Pods-ProHUD.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,12 +58,30 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1AE9C44ABAF3F797A5518CE8 /* Pods_ProHUD.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 33E080A4BE17176DF10FFA89 /* Pods */ = { + isa = PBXGroup; + children = ( + 3C95FD2F17A45D13E2AB9306 /* Pods-ProHUD.debug.xcconfig */, + DC31EBFAC56868D6096A233A /* Pods-ProHUD.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + BA9A12AB2B7D4F5C9A8C773C /* Frameworks */ = { + isa = PBXGroup; + children = ( + C2011798511AD590A613E54E /* Pods_ProHUD.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; CD16491022EF0A4B0077988C /* Alert */ = { isa = PBXGroup; children = ( @@ -98,6 +120,8 @@ CD95D26722E72D68007559A3 /* ProHUD.podspec */, CD95D21E22E72C4C007559A3 /* ProHUD */, CD95D21D22E72C4C007559A3 /* Products */, + 33E080A4BE17176DF10FFA89 /* Pods */, + BA9A12AB2B7D4F5C9A8C773C /* Frameworks */, ); sourceTree = ""; }; @@ -144,10 +168,12 @@ isa = PBXNativeTarget; buildConfigurationList = CD95D22422E72C4C007559A3 /* Build configuration list for PBXNativeTarget "ProHUD" */; buildPhases = ( + A54F2DB69A2889EF6E75A3EC /* [CP] Check Pods Manifest.lock */, CD95D21722E72C4C007559A3 /* Headers */, CD95D21822E72C4C007559A3 /* Sources */, CD95D21922E72C4C007559A3 /* Frameworks */, CD95D21A22E72C4C007559A3 /* Resources */, + 8C88ED8CC1E8972268375748 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -202,6 +228,50 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 8C88ED8CC1E8972268375748 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ProHUD/Pods-ProHUD-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + A54F2DB69A2889EF6E75A3EC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-ProHUD-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ CD95D21822E72C4C007559A3 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -350,6 +420,7 @@ }; CD95D22522E72C4C007559A3 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3C95FD2F17A45D13E2AB9306 /* Pods-ProHUD.debug.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; @@ -376,6 +447,7 @@ }; CD95D22622E72C4C007559A3 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = DC31EBFAC56868D6096A233A /* Pods-ProHUD.release.xcconfig */; buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; diff --git a/ProHUD.xcworkspace/contents.xcworkspacedata b/ProHUD.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..aabe091 --- /dev/null +++ b/ProHUD.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ProHUD.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ProHUD.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ProHUD.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ProHUD/Alert/AlertModel.swift b/ProHUD/Alert/AlertModel.swift index 32a83d3..2468b96 100644 --- a/ProHUD/Alert/AlertModel.swift +++ b/ProHUD/Alert/AlertModel.swift @@ -6,6 +6,8 @@ // Copyright © 2019 Titan Studio. All rights reserved. // +import UIKit + public extension ProHUD.Alert { enum Scene { /// 默认场景 diff --git a/ProHUD/Guard/GuardController.swift b/ProHUD/Guard/GuardController.swift index c7a4394..b3c1bf5 100644 --- a/ProHUD/Guard/GuardController.swift +++ b/ProHUD/Guard/GuardController.swift @@ -160,7 +160,7 @@ public extension ProHUD.Guard { /// - Parameter style: 样式 /// - Parameter title: 标题 /// - Parameter action: 事件 - @discardableResult func add(action style: UIAlertAction.Style, title: String?, action: (() -> Void)? = nil) -> UIButton { + @discardableResult func add(action style: UIAlertAction.Style, title: String?, action: (() -> Void)?) -> UIButton { let btn = Button.actionButton(title: title) btn.titleLabel?.font = cfg.guard.buttonFont if actionStack.superview == nil { diff --git a/ProHUD/HUDConfig.swift b/ProHUD/HUDConfig.swift index b1e7c1c..1fc6b2f 100644 --- a/ProHUD/HUDConfig.swift +++ b/ProHUD/HUDConfig.swift @@ -67,6 +67,7 @@ public extension ProHUD { } } +/// 配置 internal var cfg = ProHUD.Configuration() public extension ProHUD { diff --git a/ProHUD/HUDView.swift b/ProHUD/HUDView.swift index 23e843b..dfc2676 100644 --- a/ProHUD/HUDView.swift +++ b/ProHUD/HUDView.swift @@ -10,29 +10,6 @@ import UIKit public extension ProHUD { - class ToastWindow: UIWindow { - - var deviceOrientationDidChangeCallback: (() -> Void)? - - public override init(frame: CGRect) { - super.init(frame: frame) - - - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - - @objc func deviceOrientationDidChange(_ notification: Notification){ - DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { - self.deviceOrientationDidChangeCallback?() - } - } - - } - class StackContainer: UIStackView { public override init(frame: CGRect) { @@ -52,7 +29,6 @@ public extension ProHUD { class BlurView: UIVisualEffectView { - init() { if #available(iOS 13.0, *) { diff --git a/ProHUD/ProHUD.swift b/ProHUD/ProHUD.swift index e7d5e90..1cca6d4 100644 --- a/ProHUD/ProHUD.swift +++ b/ProHUD/ProHUD.swift @@ -37,6 +37,7 @@ internal extension ProHUD { } return b } + /// 获取Image static func image(named: String) -> UIImage? { return UIImage.init(named: named, in: bundle, compatibleWith: nil) diff --git a/ProHUD/Toast/ToastController.swift b/ProHUD/Toast/ToastController.swift index a3625ee..b9b86f8 100644 --- a/ProHUD/Toast/ToastController.swift +++ b/ProHUD/Toast/ToastController.swift @@ -225,7 +225,7 @@ public extension ProHUD { let config = cfg.toast let isNew: Bool if toast.window == nil { - let w = ToastWindow(frame: .zero) + let w = UIWindow(frame: .zero) toast.window = w w.windowLevel = UIWindow.Level(5000) w.backgroundColor = .clear diff --git a/ProHUD/Toast/ToastModel.swift b/ProHUD/Toast/ToastModel.swift index b9d1353..6fe3c76 100644 --- a/ProHUD/Toast/ToastModel.swift +++ b/ProHUD/Toast/ToastModel.swift @@ -6,6 +6,8 @@ // Copyright © 2019 Titan Studio. All rights reserved. // +import UIKit + public extension ProHUD.Toast { enum Scene { /// 默认场景