From b2a73f1c1bf5a5a318bb837ba3fe33e8d73e3102 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 11 Dec 2023 15:27:41 +0800 Subject: [PATCH] fix warning --- .../xcshareddata/xcschemes/ProHUD.xcscheme | 2 +- PHDemo/PHDemo.xcodeproj/project.pbxproj | 26 +++------------ .../xcshareddata/swiftpm/Package.resolved | 2 +- Package.resolved | 33 +++++++------------ .../ProHUD/Capsule/CapsuleDefaultLayout.swift | 4 +-- Sources/ProHUD/Toast/ToastDefaultLayout.swift | 1 - 6 files changed, 20 insertions(+), 48 deletions(-) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/ProHUD.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/ProHUD.xcscheme index 505874b..b6968e3 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/ProHUD.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/ProHUD.xcscheme @@ -1,6 +1,6 @@ 0 }).joined(separator: " ") + let text = [vm?.title ?? "", vm?.message ?? ""].filter({ $0.count > 0 }).joined(separator: " ") if text.count > 0 { textLabel.snp.remakeConstraints { make in make.width.lessThanOrEqualTo(AppContext.appBounds.width * 0.5) @@ -113,7 +113,7 @@ extension CapsuleTarget: DefaultLayout { func getWindowSize(window: CapsuleWindow) -> CGSize { let cardEdgeInsetsByDefault = config.cardEdgeInsetsByDefault view.layoutIfNeeded() - var size = contentStack.frame.size + let size = contentStack.frame.size let width = min(config.cardMaxWidthByDefault, size.width + cardEdgeInsetsByDefault.left + cardEdgeInsetsByDefault.right) let height = min(config.cardMaxHeightByDefault, size.height + cardEdgeInsetsByDefault.top + cardEdgeInsetsByDefault.bottom) return .init(width: max(width, config.cardMinWidth ?? 0), height: max(height, config.cardMinHeight)) diff --git a/Sources/ProHUD/Toast/ToastDefaultLayout.swift b/Sources/ProHUD/Toast/ToastDefaultLayout.swift index fe3dcc3..051719e 100644 --- a/Sources/ProHUD/Toast/ToastDefaultLayout.swift +++ b/Sources/ProHUD/Toast/ToastDefaultLayout.swift @@ -150,7 +150,6 @@ extension ToastTarget { } func getWindowSize(window: ToastWindow) -> CGSize { - let cardEdgeInsets = config.cardEdgeInsetsByDefault let width = CGFloat.minimum(AppContext.appBounds.width - config.marginX - config.marginX, config.cardMaxWidthByDefault) view.frame.size = CGSize(width: width, height: config.cardMaxHeightByDefault) // 以最大高度开始布局,然后计算实际需要高度 titleLabel.sizeToFit()