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()