兼容Xcode11+iOS13应用
|
@ -18,6 +18,7 @@ class RootVC: UIViewController {
|
||||||
let nav = UINavigationController(rootViewController: vc)
|
let nav = UINavigationController(rootViewController: vc)
|
||||||
addChild(nav)
|
addChild(nav)
|
||||||
view.addSubview(nav.view)
|
view.addSubview(nav.view)
|
||||||
|
nav.navigationBar.prefersLargeTitles = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class TestGuardVC: BaseListVC {
|
||||||
}
|
}
|
||||||
|
|
||||||
override var titles: [String] {
|
override var titles: [String] {
|
||||||
return ["场景:删除菜单", "场景:升级至专业版", "场景:隐私协议页面"]
|
return ["场景:删除菜单", "场景:升级至专业版", "场景:隐私协议页面", "对比:原生的ActionSheet", "对比:原生Present效果"]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
|
@ -53,6 +53,7 @@ class TestGuardVC: BaseListVC {
|
||||||
vm.add(message: "功能1功能2...")
|
vm.add(message: "功能1功能2...")
|
||||||
vm.add(subTitle: "价格")
|
vm.add(subTitle: "价格")
|
||||||
vm.add(message: "只需一次性付费$2999即可永久享用。")
|
vm.add(message: "只需一次性付费$2999即可永久享用。")
|
||||||
|
vm.add(message: "只需一次性付费$2999即可永久享用。")
|
||||||
vm.add(action: .destructive, title: "购买") { [weak vc] in
|
vm.add(action: .destructive, title: "购买") { [weak vc] in
|
||||||
Alert.push(scene: .buy) { (vc) in
|
Alert.push(scene: .buy) { (vc) in
|
||||||
vc.identifier = "confirm"
|
vc.identifier = "confirm"
|
||||||
|
@ -107,7 +108,20 @@ class TestGuardVC: BaseListVC {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if row == 3 {
|
||||||
|
let ac = UIAlertController(title: "Title", message: "message", preferredStyle: .actionSheet)
|
||||||
|
let ok = UIAlertAction(title: "OK", style: .default, handler: nil)
|
||||||
|
let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
||||||
|
ac.addAction(ok)
|
||||||
|
ac.addAction(cancel)
|
||||||
|
self.present(ac, animated: true, completion: nil)
|
||||||
|
} else if row == 4 {
|
||||||
|
let vc = UIViewController()
|
||||||
|
vc.view.backgroundColor = .white
|
||||||
|
vc.title = "ceshi"
|
||||||
|
present(vc, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import ProHUD
|
//import ProHUD
|
||||||
import SnapKit
|
import SnapKit
|
||||||
|
|
||||||
class ViewController: BaseListVC {
|
class ViewController: BaseListVC {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* 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 */; };
|
CD16490B22EF09AB0077988C /* AlertModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490A22EF09AB0077988C /* AlertModel.swift */; };
|
||||||
CD16490D22EF09B40077988C /* AlertConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490C22EF09B40077988C /* AlertConfig.swift */; };
|
CD16490D22EF09B40077988C /* AlertConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16490C22EF09B40077988C /* AlertConfig.swift */; };
|
||||||
CD16491222EF0D900077988C /* HUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16491122EF0D900077988C /* HUDView.swift */; };
|
CD16491222EF0D900077988C /* HUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16491122EF0D900077988C /* HUDView.swift */; };
|
||||||
|
@ -57,7 +56,6 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
CDC67BEC2490A1D100CC6FE6 /* Inspire in Frameworks */,
|
CDC67BEC2490A1D100CC6FE6 /* Inspire in Frameworks */,
|
||||||
1AE9C44ABAF3F797A5518CE8 /* Pods_ProHUD.framework in Frameworks */,
|
|
||||||
CDC67BE92490A19100CC6FE6 /* SnapKit in Frameworks */,
|
CDC67BE92490A19100CC6FE6 /* SnapKit in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -431,6 +429,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD;
|
PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
@ -458,6 +457,7 @@
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD;
|
PRODUCT_BUNDLE_IDENTIFIER = com.xaoxuu.ProHUD;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "self:ProHUD.xcodeproj">
|
location = "self:">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"object": {
|
||||||
|
"pins": [
|
||||||
|
{
|
||||||
|
"package": "Inspire",
|
||||||
|
"repositoryURL": "https://github.com/xaoxuu/Inspire",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "fed13e3530ca38f884d190ea5c7b12b8f3b2a41b",
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "SnapKit",
|
||||||
|
"repositoryURL": "https://github.com/SnapKit/SnapKit",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "d458564516e5676af9c70b4f4b2a9178294f1bc6",
|
||||||
|
"version": "5.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
|
@ -94,6 +94,11 @@ public extension Alert {
|
||||||
window.makeKeyAndVisible()
|
window.makeKeyAndVisible()
|
||||||
window.resignKey()
|
window.resignKey()
|
||||||
window.addSubview(view)
|
window.addSubview(view)
|
||||||
|
if #available(iOS 13.0, *) {
|
||||||
|
window.windowScene = cfg.windowScene
|
||||||
|
} else {
|
||||||
|
// Fallback on earlier versions
|
||||||
|
}
|
||||||
view.transform = .init(scaleX: 1.2, y: 1.2)
|
view.transform = .init(scaleX: 1.2, y: 1.2)
|
||||||
view.alpha = 0
|
view.alpha = 0
|
||||||
UIView.animateForAlertBuildIn {
|
UIView.animateForAlertBuildIn {
|
||||||
|
@ -153,7 +158,7 @@ public extension Alert {
|
||||||
if flag {
|
if flag {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
let ani = CABasicAnimation(keyPath: "transform.rotation.z")
|
let ani = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
ani.toValue = Double.pi * 2.0
|
ani.toValue = -Double.pi * 2.0
|
||||||
ani.duration = 3
|
ani.duration = 3
|
||||||
ani.repeatCount = 10000
|
ani.repeatCount = 10000
|
||||||
self.imageView?.layer.add(ani, forKey: "rotationAnimation")
|
self.imageView?.layer.add(ani, forKey: "rotationAnimation")
|
||||||
|
|
|
@ -232,7 +232,8 @@ internal extension Guard {
|
||||||
if #available(iOS 11.0, *) {
|
if #available(iOS 11.0, *) {
|
||||||
let count = textStack.arrangedSubviews.count
|
let count = textStack.arrangedSubviews.count
|
||||||
if count > 1 {
|
if count > 1 {
|
||||||
textStack.setCustomSpacing(cfg.guard.margin * 2, after: textStack.arrangedSubviews[count-2])
|
textStack.setCustomSpacing(cfg.guard.margin * 3, after: textStack.arrangedSubviews[count-2])
|
||||||
|
textStack.setCustomSpacing(cfg.guard.margin * 1.5, after: textStack.arrangedSubviews[count-1])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fallback on earlier versions
|
// Fallback on earlier versions
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
@available(iOS 13.0, *)
|
||||||
|
public var sharedWindowScene: UIWindowScene?
|
||||||
|
|
||||||
public extension ProHUD {
|
public extension ProHUD {
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
|
|
||||||
|
@ -17,20 +20,32 @@ public extension ProHUD {
|
||||||
/// 根控制器
|
/// 根控制器
|
||||||
public var rootViewController: UIViewController?
|
public var rootViewController: UIViewController?
|
||||||
|
|
||||||
|
@available(iOS 13.0, *)
|
||||||
|
|
||||||
|
/// Xcode11 创建的基于 windowScene 的应用必须设置此值
|
||||||
|
public var windowScene: UIWindowScene? {
|
||||||
|
set {
|
||||||
|
sharedWindowScene = newValue
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
return sharedWindowScene
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 动态颜色(适配iOS13)
|
/// 动态颜色(适配iOS13)
|
||||||
public lazy var dynamicColor: UIColor = {
|
public lazy var dynamicColor: UIColor = {
|
||||||
// if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
// let color = UIColor { (traitCollection: UITraitCollection) -> UIColor in
|
let color = UIColor { (traitCollection: UITraitCollection) -> UIColor in
|
||||||
// if traitCollection.userInterfaceStyle == .dark {
|
if traitCollection.userInterfaceStyle == .dark {
|
||||||
// return .init(white: 1, alpha: 1)
|
return .init(white: 1, alpha: 1)
|
||||||
// } else {
|
} else {
|
||||||
// return .init(white: 0.1, alpha: 1)
|
return .init(white: 0.1, alpha: 1)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return color
|
return color
|
||||||
// } else {
|
} else {
|
||||||
// // Fallback on earlier versions
|
// Fallback on earlier versions
|
||||||
// }
|
}
|
||||||
return .init(white: 0.1, alpha: 1)
|
return .init(white: 0.1, alpha: 1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -87,8 +102,7 @@ internal var createBlurView: () -> UIVisualEffectView = {
|
||||||
return {
|
return {
|
||||||
let vev = UIVisualEffectView()
|
let vev = UIVisualEffectView()
|
||||||
if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
// vev.effect = UIBlurEffect(style: .systemMaterial)
|
vev.effect = UIBlurEffect(style: .systemMaterial)
|
||||||
vev.effect = UIBlurEffect(style: .extraLight)
|
|
||||||
} else if #available(iOS 11.0, *) {
|
} else if #available(iOS 11.0, *) {
|
||||||
vev.effect = UIBlurEffect(style: .extraLight)
|
vev.effect = UIBlurEffect(style: .extraLight)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "fail@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDError@2x.png",
|
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "fail@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDError@3x.png",
|
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
|
@ -5,18 +5,50 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "loading@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDLoading@2x.png",
|
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "loading_dark@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "loading@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "loading_dark@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDLoading@3x.png",
|
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 5.8 KiB |
|
@ -5,18 +5,18 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "success@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDSuccess@2x.png",
|
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "success@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDSuccess@3x.png",
|
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 5.9 KiB |
|
@ -5,18 +5,18 @@
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "warning@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDWarning@2x.png",
|
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"filename" : "warning@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "ProHUDWarning@3x.png",
|
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
|
@ -111,6 +111,11 @@ public extension Toast {
|
||||||
if self.window == nil {
|
if self.window == nil {
|
||||||
let w = UIWindow(frame: .zero)
|
let w = UIWindow(frame: .zero)
|
||||||
self.window = w
|
self.window = w
|
||||||
|
if #available(iOS 13.0, *) {
|
||||||
|
w.windowScene = cfg.windowScene
|
||||||
|
} else {
|
||||||
|
// Fallback on earlier versions
|
||||||
|
}
|
||||||
w.windowLevel = UIWindow.Level(5000)
|
w.windowLevel = UIWindow.Level(5000)
|
||||||
w.backgroundColor = .clear
|
w.backgroundColor = .clear
|
||||||
w.layer.shadowRadius = 8
|
w.layer.shadowRadius = 8
|
||||||
|
@ -182,7 +187,7 @@ public extension Toast {
|
||||||
if flag {
|
if flag {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
let ani = CABasicAnimation(keyPath: "transform.rotation.z")
|
let ani = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
ani.toValue = Double.pi * 2.0
|
ani.toValue = -Double.pi * 2.0
|
||||||
ani.duration = 3
|
ani.duration = 3
|
||||||
ani.repeatCount = 10000
|
ani.repeatCount = 10000
|
||||||
self.imageView.layer.add(ani, forKey: "rotationAnimation")
|
self.imageView.layer.add(ani, forKey: "rotationAnimation")
|
||||||
|
|