From db9a8c7febd0e28a1242328961e56cd9e66f6030 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 3 May 2024 23:01:35 -0700 Subject: [PATCH] Fix some concurrency warnings. --- iOS/Article/ArticleSearchBar.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iOS/Article/ArticleSearchBar.swift b/iOS/Article/ArticleSearchBar.swift index c69cfdd4c..4e7e4f17b 100644 --- a/iOS/Article/ArticleSearchBar.swift +++ b/iOS/Article/ArticleSearchBar.swift @@ -8,11 +8,11 @@ import UIKit -@objc protocol SearchBarDelegate: NSObjectProtocol { - @objc optional func nextWasPressed(_ searchBar: ArticleSearchBar) - @objc optional func previousWasPressed(_ searchBar: ArticleSearchBar) - @objc optional func doneWasPressed(_ searchBar: ArticleSearchBar) - @objc optional func searchBar(_ searchBar: ArticleSearchBar, textDidChange: String) +protocol SearchBarDelegate: AnyObject { + @MainActor func nextWasPressed(_ searchBar: ArticleSearchBar) + @MainActor func previousWasPressed(_ searchBar: ArticleSearchBar) + @MainActor func doneWasPressed(_ searchBar: ArticleSearchBar) + @MainActor func searchBar(_ searchBar: ArticleSearchBar, textDidChange: String) } @@ -146,7 +146,7 @@ private extension ArticleSearchBar { private extension ArticleSearchBar { @objc func textDidChange(_ notification: Notification) { - delegate?.searchBar?(self, textDidChange: searchField.text ?? "") + delegate?.searchBar(self, textDidChange: searchField.text ?? "") if searchField.text?.isEmpty ?? true { searchField.rightViewMode = .never @@ -156,21 +156,21 @@ private extension ArticleSearchBar { } @objc func nextPressed() { - delegate?.nextWasPressed?(self) + delegate?.nextWasPressed(self) } @objc func previousPressed() { - delegate?.previousWasPressed?(self) + delegate?.previousWasPressed(self) } @objc func donePressed(_ _: Any? = nil) { - delegate?.doneWasPressed?(self) + delegate?.doneWasPressed(self) } } extension ArticleSearchBar: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { - delegate?.nextWasPressed?(self) + delegate?.nextWasPressed(self) return false } }