From b62c027cd52216cb90c84c5652308cfd7898c55a Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 19 Sep 2022 20:43:42 +0800 Subject: [PATCH] discardableResult --- Sources/ProHUD/Alert/AlertConvenienceLayout.swift | 4 ++-- Sources/ProHUD/Sheet/SheetConvenienceLayout.swift | 4 ++-- Sources/ProHUD/Toast/ToastConvenienceLayout.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/ProHUD/Alert/AlertConvenienceLayout.swift b/Sources/ProHUD/Alert/AlertConvenienceLayout.swift index fd4ec4e..aaf5eec 100644 --- a/Sources/ProHUD/Alert/AlertConvenienceLayout.swift +++ b/Sources/ProHUD/Alert/AlertConvenienceLayout.swift @@ -13,7 +13,7 @@ extension Alert: InternalConvenienceLayout { @discardableResult public func add(action: Action) -> Button { insert(action: action, at: actionStack.arrangedSubviews.count) } - public func insert(action: Action, at index: Int) -> Button { + @discardableResult public func insert(action: Action, at index: Int) -> Button { let btn = Button(config: config, action: action) if index < actionStack.arrangedSubviews.count { actionStack.insertArrangedSubview(btn, at: index) @@ -106,7 +106,7 @@ extension Alert: InternalConvenienceLayout { // MARK: 完全自定义布局 - public func set(customView: UIView) -> UIView { + @discardableResult public func set(customView: UIView) -> UIView { self.customView = customView contentView.subviews.forEach({ $0.removeFromSuperview() }) contentView.addSubview(customView) diff --git a/Sources/ProHUD/Sheet/SheetConvenienceLayout.swift b/Sources/ProHUD/Sheet/SheetConvenienceLayout.swift index 19805bb..d7198e7 100644 --- a/Sources/ProHUD/Sheet/SheetConvenienceLayout.swift +++ b/Sources/ProHUD/Sheet/SheetConvenienceLayout.swift @@ -13,7 +13,7 @@ extension Sheet: ConvenienceLayout { @discardableResult public func add(action: Action) -> Button { insert(action: action, at: contentStack.arrangedSubviews.count) } - public func insert(action: Action, at index: Int) -> Button { + @discardableResult public func insert(action: Action, at index: Int) -> Button { let btn = SheetButton(config: config, action: action) if index < contentStack.arrangedSubviews.count { contentStack.insertArrangedSubview(btn, at: index) @@ -102,7 +102,7 @@ extension Sheet: ConvenienceLayout { // MARK: 完全自定义布局 - public func set(customView: UIView) -> UIView { + @discardableResult public func set(customView: UIView) -> UIView { self.customView = customView contentView.addSubview(customView) return customView diff --git a/Sources/ProHUD/Toast/ToastConvenienceLayout.swift b/Sources/ProHUD/Toast/ToastConvenienceLayout.swift index 5960195..26c6e0f 100644 --- a/Sources/ProHUD/Toast/ToastConvenienceLayout.swift +++ b/Sources/ProHUD/Toast/ToastConvenienceLayout.swift @@ -21,7 +21,7 @@ public extension Toast { insert(action: action, at: actionStack.arrangedSubviews.count) } - func insert(action: Action, at index: Int) -> Button { + @discardableResult func insert(action: Action, at index: Int) -> Button { let btn = ToastButton(config: config, action: action) if index < actionStack.arrangedSubviews.count { actionStack.insertArrangedSubview(btn, at: index)