From 0832a7cf67ff133b5056846df6522e75c8d63cda Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 1 Jan 2026 17:55:12 -0800 Subject: [PATCH] Fix various SwiftLint warnings. --- Mac/Browser.swift | 1 - .../FeedInspectorViewController.swift | 4 - Mac/Inspector/InspectorWindowController.swift | 7 +- .../Detail/DetailStatusBarView.swift | 2 - Mac/MainWindow/Sidebar/PasteboardFeed.swift | 4 +- Mac/MainWindow/Sidebar/PasteboardFolder.swift | 2 - .../Sidebar/SidebarViewController.swift | 2 - ...melineViewController+ContextualMenus.swift | 3 - .../Timeline/TimelineViewController.swift | 3 +- .../AccountsPreferencesViewController.swift | 1 - .../AccountsReaderAPIWindowController.swift | 1 - .../Accounts/AddAccountsView.swift | 6 - Mac/Scripting/Account+Scriptability.swift | 2 +- Mac/Scripting/AppDelegate+Scriptability.swift | 1 - Mac/Scripting/Feed+Scriptability.swift | 262 +++++++++--------- .../NSApplication+Scriptability.swift | 7 +- .../NSScriptCommand+NetNewsWire.swift | 2 +- .../LocalAccount/LocalAccountRefresher.swift | 3 +- .../ArticlesDatabase/ArticlesTable.swift | 8 +- .../ArticlesDatabase/AuthorsTable.swift | 2 - .../Sources/CloudKitSync/CloudKitZone.swift | 1 - .../Sources/FeedFinder/FeedSpecifier.swift | 2 +- .../RSCore/AppKit/RSAppMovementMonitor.swift | 4 +- .../Sources/RSCore/AppKit/UserApp.swift | 6 +- Modules/RSCore/Sources/RSCore/RSImage.swift | 6 +- .../RSCore/Sources/RSCore/String+RSCore.swift | 1 - .../RSCore/UIKit/UIResponder+RSCore.swift | 2 +- .../Swift/Feeds/JSON/RSSInJSONParser.swift | 4 +- Modules/RSTree/Sources/RSTree/Node.swift | 1 - .../RSWeb/Sources/RSWeb/SpecialCases.swift | 1 - .../FeedbinAccountViewController.swift | 3 - .../ReaderAPIAccountViewController.swift | 4 - iOS/Article/ArticleSearchBar.swift | 1 - iOS/Article/ArticleViewController.swift | 1 - iOS/Article/ImageScrollView.swift | 1 - iOS/Article/ImageViewController.swift | 2 - iOS/Article/WebViewController.swift | 3 - ...MainFeedCollectionHeaderReusableView.swift | 1 - .../MainFeedCollectionViewCell.swift | 4 +- .../MainFeedCollectionViewFolderCell.swift | 2 - ...ainFeedCollectionViewController+Drag.swift | 3 - ...ainFeedCollectionViewController+Drop.swift | 1 - .../MainFeedCollectionViewController.swift | 42 +-- .../Cells/MainTimelineFeedCell.swift | 2 - .../Cells/MainTimelineIconFeedCell.swift | 3 - .../MainTimelineViewController.swift | 1 - .../MarkAsReadAlertController.swift | 2 - iOS/SceneCoordinator.swift | 4 - iOS/SceneDelegate.swift | 2 - ...imelineCustomizerTableViewController.swift | 1 - iOS/Settings/SettingsViewController.swift | 7 +- iOS/ShareExtension/ShareViewController.swift | 6 +- 52 files changed, 165 insertions(+), 282 deletions(-) diff --git a/Mac/Browser.swift b/Mac/Browser.swift index 6676893d0..523e75acd 100644 --- a/Mac/Browser.swift +++ b/Mac/Browser.swift @@ -32,7 +32,6 @@ import RSWeb open(urlString, inBackground: invert ? !AppDefaults.shared.openInBrowserInBackground : AppDefaults.shared.openInBrowserInBackground) } - /// Opens a URL in the default browser. /// /// - Parameters: diff --git a/Mac/Inspector/FeedInspectorViewController.swift b/Mac/Inspector/FeedInspectorViewController.swift index 0f924d536..bc369450e 100644 --- a/Mac/Inspector/FeedInspectorViewController.swift +++ b/Mac/Inspector/FeedInspectorViewController.swift @@ -13,7 +13,6 @@ import Articles import Account final class FeedInspectorViewController: NSViewController, Inspector { - @IBOutlet var iconView: IconView! @IBOutlet var nameTextField: NSTextField? @IBOutlet var homePageURLTextField: NSTextField? @@ -114,7 +113,6 @@ final class FeedInspectorViewController: NSViewController, Inspector { @objc func imageDidBecomeAvailable(_ note: Notification) { updateImage() } - } extension FeedInspectorViewController: NSTextFieldDelegate { @@ -122,7 +120,6 @@ extension FeedInspectorViewController: NSTextFieldDelegate { func controlTextDidEndEditing(_ note: Notification) { renameFeedIfNecessary() } - } private extension FeedInspectorViewController { @@ -135,7 +132,6 @@ private extension FeedInspectorViewController { feed = singleFeed } - @objc func updateUI() { updateImage() updateName() diff --git a/Mac/Inspector/InspectorWindowController.swift b/Mac/Inspector/InspectorWindowController.swift index 35ca11ebf..5837b128a 100644 --- a/Mac/Inspector/InspectorWindowController.swift +++ b/Mac/Inspector/InspectorWindowController.swift @@ -9,7 +9,6 @@ import AppKit @MainActor protocol Inspector: AnyObject { - var objects: [Any]? { get set } var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects. var windowTitle: String { get } @@ -19,10 +18,8 @@ import AppKit typealias InspectorViewController = Inspector & NSViewController - final class InspectorWindowController: NSWindowController { - - class var shouldOpenAtStartup: Bool { + static var shouldOpenAtStartup: Bool { return UserDefaults.standard.bool(forKey: DefaultsKey.windowIsOpen) } @@ -75,7 +72,7 @@ final class InspectorWindowController: NSWindowController { func inspector(for objects: [Any]?) -> InspectorViewController { - var fallbackInspector: InspectorViewController? = nil + var fallbackInspector: InspectorViewController? for inspector in inspectors { if inspector.isFallbackInspector { diff --git a/Mac/MainWindow/Detail/DetailStatusBarView.swift b/Mac/MainWindow/Detail/DetailStatusBarView.swift index db550f430..62577648a 100644 --- a/Mac/MainWindow/Detail/DetailStatusBarView.swift +++ b/Mac/MainWindow/Detail/DetailStatusBarView.swift @@ -74,5 +74,3 @@ private extension DetailStatusBarView { } } } - - diff --git a/Mac/MainWindow/Sidebar/PasteboardFeed.swift b/Mac/MainWindow/Sidebar/PasteboardFeed.swift index 6bc246808..63880f262 100644 --- a/Mac/MainWindow/Sidebar/PasteboardFeed.swift +++ b/Mac/MainWindow/Sidebar/PasteboardFeed.swift @@ -63,7 +63,7 @@ struct PasteboardFeed: Hashable { let feedID = dictionary[Key.feedID] let editedName = dictionary[Key.editedName] - var accountType: AccountType? = nil + var accountType: AccountType? if let accountTypeString = dictionary[Key.accountType], let accountTypeInt = Int(accountTypeString) { accountType = AccountType(rawValue: accountTypeInt) } @@ -168,7 +168,7 @@ extension Feed: @retroactive PasteboardWriterOwner { static let feedUTIInternal = "com.ranchero.NetNewsWire-Evergreen.internal.feed" static let feedUTIInternalType = NSPasteboard.PasteboardType(rawValue: feedUTIInternal) - var containerID: ContainerIdentifier? = nil + var containerID: ContainerIdentifier? init(feed: Feed) { self.feed = feed diff --git a/Mac/MainWindow/Sidebar/PasteboardFolder.swift b/Mac/MainWindow/Sidebar/PasteboardFolder.swift index 7ef217bab..9a5a2582f 100644 --- a/Mac/MainWindow/Sidebar/PasteboardFolder.swift +++ b/Mac/MainWindow/Sidebar/PasteboardFolder.swift @@ -13,7 +13,6 @@ import RSCore typealias PasteboardFolderDictionary = [String: String] @MainActor struct PasteboardFolder: Hashable { - private struct Key { static let name = "name" // Internal @@ -21,7 +20,6 @@ typealias PasteboardFolderDictionary = [String: String] static let accountID = "accountID" } - let name: String let folderID: String? let accountID: String? diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 1d20ddf57..1655e1d19 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -392,7 +392,6 @@ extension Notification.Name { menu.takeItems(from: contextualMenu) } - // MARK: - NSOutlineViewDelegate func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { @@ -602,7 +601,6 @@ private extension SidebarViewController { treeControllerDelegate.addFilterException(folderSidebarItemID) } - func queueRebuildTreeAndRestoreSelection() { rebuildTreeAndRestoreSelectionQueue.add(self, #selector(rebuildTreeAndRestoreSelection)) } diff --git a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift index 2dc0a94c8..9f9fb92de 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController+ContextualMenus.swift @@ -114,7 +114,6 @@ extension TimelineViewController { } } - private extension TimelineViewController { func markArticles(_ articles: [Article], read: Bool) { @@ -286,7 +285,6 @@ private extension TimelineViewController { return menuItem(NSLocalizedString("Copy External URL", comment: "Command"), #selector(copyURLFromContextualMenu(_:)), urlString, image: Assets.Images.copy) } - func menuItem(_ title: String, _ action: Selector, _ representedObject: Any, image: RSImage?) -> NSMenuItem { let item = NSMenuItem(title: title, action: action, keyEquivalent: "") @@ -300,7 +298,6 @@ private extension TimelineViewController { } private final class SharingCommandInfo { - let service: NSSharingService let items: [Any] diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index feb765b73..c6cd122f0 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -387,7 +387,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr } } - // MARK: - Actions @objc func openArticleInBrowser(_ sender: Any?) { @@ -560,7 +559,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr func markOlderArticlesRead(_ selectedArticles: [Article]) { // Mark articles older than the selectedArticles(s) as read. - var cutoffDate: Date? = nil + var cutoffDate: Date? for article in selectedArticles { if cutoffDate == nil { cutoffDate = article.logicalDatePublished diff --git a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift index 90075c89a..74a70dbbe 100644 --- a/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift +++ b/Mac/Preferences/Accounts/AccountsPreferencesViewController.swift @@ -40,7 +40,6 @@ final class AccountsPreferencesViewController: NSViewController { NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .UserDidAddAccount, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .UserDidDeleteAccount, object: nil) - // Fix tableView frame — for some reason IB wants it 1pt wider than the clip view. This leads to unwanted horizontal scrolling. var rTable = tableView.frame rTable.size.width = tableView.superview!.frame.size.width diff --git a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift index 2717014de..c8dd1f08a 100644 --- a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift @@ -174,7 +174,6 @@ final class AccountsReaderAPIWindowController: NSWindowController { errorMessageLabel.stringValue = NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error") } - } catch { stopAnimation() errorMessageLabel.stringValue = NSLocalizedString("Network error. Try again later.", comment: "Credentials Error") diff --git a/Mac/Preferences/Accounts/AddAccountsView.swift b/Mac/Preferences/Accounts/AddAccountsView.swift index 1cdf69990..e7db377e9 100644 --- a/Mac/Preferences/Accounts/AddAccountsView.swift +++ b/Mac/Preferences/Accounts/AddAccountsView.swift @@ -68,10 +68,6 @@ enum AddAccountSections: Int, CaseIterable { AddAccountSections.selfhosted.sectionContent } } - - - - } struct AddAccountsView: View { @@ -264,10 +260,8 @@ struct AddAccountsView: View { } } - struct AddAccountsView_Previews: PreviewProvider { static var previews: some View { AddAccountsView(delegate: nil) } } - diff --git a/Mac/Scripting/Account+Scriptability.swift b/Mac/Scripting/Account+Scriptability.swift index d933a16a5..46c7c03e0 100644 --- a/Mac/Scripting/Account+Scriptability.swift +++ b/Mac/Scripting/Account+Scriptability.swift @@ -73,7 +73,7 @@ import RSCore } } else if let scriptableFeed = element as? ScriptableFeed { BatchUpdate.shared.perform { - var container: Container? = nil + var container: Container? if let scriptableFolder = scriptableFeed.container as? ScriptableFolder { container = scriptableFolder.folder } else { diff --git a/Mac/Scripting/AppDelegate+Scriptability.swift b/Mac/Scripting/AppDelegate+Scriptability.swift index 672c8febb..20710ad6f 100644 --- a/Mac/Scripting/AppDelegate+Scriptability.swift +++ b/Mac/Scripting/AppDelegate+Scriptability.swift @@ -77,7 +77,6 @@ extension AppDelegate: AppDelegateAppleEvents { } - // Special case URL with specific scheme handler x-netnewswire-feed: intended to ensure we open // it regardless of which news reader may be set as the default let nnwScheme = "x-netnewswire-feed:" diff --git a/Mac/Scripting/Feed+Scriptability.swift b/Mac/Scripting/Feed+Scriptability.swift index 96963c99c..23e6396a2 100644 --- a/Mac/Scripting/Feed+Scriptability.swift +++ b/Mac/Scripting/Feed+Scriptability.swift @@ -13,120 +13,120 @@ import Articles @objc(ScriptableFeed) @MainActor final class ScriptableFeed: NSObject, UniqueIDScriptingObject, @preconcurrency ScriptingObjectContainer { - let feed: Feed - nonisolated(unsafe) let container: ScriptingObjectContainer + let feed: Feed + nonisolated(unsafe) let container: ScriptingObjectContainer - init (_ feed: Feed, container: ScriptingObjectContainer) { - self.feed = feed - self.container = container - } + init (_ feed: Feed, container: ScriptingObjectContainer) { + self.feed = feed + self.container = container + } - @objc(objectSpecifier) - nonisolated override var objectSpecifier: NSScriptObjectSpecifier? { - let scriptObjectSpecifier = self.container.makeFormUniqueIDScriptObjectSpecifier(forObject:self) - return scriptObjectSpecifier - } + @objc(objectSpecifier) + nonisolated override var objectSpecifier: NSScriptObjectSpecifier? { + let scriptObjectSpecifier = self.container.makeFormUniqueIDScriptObjectSpecifier(forObject: self) + return scriptObjectSpecifier + } - @objc(scriptingSpecifierDescriptor) - func scriptingSpecifierDescriptor() -> NSScriptObjectSpecifier { - objectSpecifier ?? NSScriptObjectSpecifier() - } + @objc(scriptingSpecifierDescriptor) + func scriptingSpecifierDescriptor() -> NSScriptObjectSpecifier { + objectSpecifier ?? NSScriptObjectSpecifier() + } - // MARK: --- ScriptingObject protocol --- + // MARK: - ScriptingObject protocol - nonisolated var scriptingKey: String { - "feeds" - } + nonisolated var scriptingKey: String { + "feeds" + } - // MARK: --- UniqueIdScriptingObject protocol --- + // MARK: - UniqueIdScriptingObject protocol - // I am not sure if account should prefer to be specified by name or by ID - // but in either case it seems like the accountID would be used as the keydata, so I chose ID - @objc(uniqueId) - nonisolated var scriptingUniqueID: Any { - feed.feedID - } + // I am not sure if account should prefer to be specified by name or by ID + // but in either case it seems like the accountID would be used as the keydata, so I chose ID + @objc(uniqueId) + nonisolated var scriptingUniqueID: Any { + feed.feedID + } - // MARK: --- ScriptingObjectContainer protocol --- + // MARK: - ScriptingObjectContainer protocol - nonisolated var scriptingClassDescription: NSScriptClassDescription { - classDescription as! NSScriptClassDescription - } + nonisolated var scriptingClassDescription: NSScriptClassDescription { + classDescription as! NSScriptClassDescription + } - func deleteElement(_ element:ScriptingObject) { - } + func deleteElement(_ element: ScriptingObject) { + } - // MARK: --- handle NSCreateCommand --- + // MARK: - Handle NSCreateCommand - class func urlForNewFeed(arguments: [String:Any]) -> String? { - var url: String? - if let withDataParam = arguments["ObjectData"] { - if let objectDataDescriptor = withDataParam as? NSAppleEventDescriptor { - url = objectDataDescriptor.stringValue - } - } else if let withPropsParam = arguments["ObjectProperties"] as? [String:Any] { - url = withPropsParam["url"] as? String - } - return url - } + static func urlForNewFeed(arguments: [String: Any]) -> String? { + var url: String? + if let withDataParam = arguments["ObjectData"] { + if let objectDataDescriptor = withDataParam as? NSAppleEventDescriptor { + url = objectDataDescriptor.stringValue + } + } else if let withPropsParam = arguments["ObjectProperties"] as? [String: Any] { + url = withPropsParam["url"] as? String + } + return url + } - class func scriptableFeed(_ feed: Feed, account: Account, folder: Folder?) -> ScriptableFeed { - let scriptableAccount = ScriptableAccount(account) - if let folder = folder { - let scriptableFolder = ScriptableFolder(folder, container: scriptableAccount) - return ScriptableFeed(feed, container: scriptableFolder) - } else { - return ScriptableFeed(feed, container: scriptableAccount) - } - } + static func scriptableFeed(_ feed: Feed, account: Account, folder: Folder?) -> ScriptableFeed { + let scriptableAccount = ScriptableAccount(account) + if let folder = folder { + let scriptableFolder = ScriptableFolder(folder, container: scriptableAccount) + return ScriptableFeed(feed, container: scriptableFolder) + } else { + return ScriptableFeed(feed, container: scriptableAccount) + } + } - class func scriptableFeed(for feed: Feed) -> ScriptableFeed? { + static func scriptableFeed(for feed: Feed) -> ScriptableFeed? { guard let account = feed.account else { return nil } - // Find the proper container hierarchy - let containers = account.existingContainers(withFeed: feed) - var folder: Folder? + // Find the proper container hierarchy + let containers = account.existingContainers(withFeed: feed) + var folder: Folder? - // Check if feed is in a folder - for container in containers { - if let foundFolder = container as? Folder { - folder = foundFolder - break - } - } + // Check if feed is in a folder + for container in containers { + if let foundFolder = container as? Folder { + folder = foundFolder + break + } + } - return scriptableFeed(feed, account: account, folder: folder) - } + return scriptableFeed(feed, account: account, folder: folder) + } - static func handleCreateElement(command: NSCreateCommand) -> Any? { - guard command.isCreateCommand(forClass:"Feed") else { + static func handleCreateElement(command: NSCreateCommand) -> Any? { + guard command.isCreateCommand(forClass: "Feed") else { return nil } guard let arguments = command.arguments else { return nil } - let titleFromArgs = command.property(forKey: "name") as? String - let (account, folder) = command.accountAndFolderForNewChild() - guard let url = self.urlForNewFeed(arguments:arguments) else { + let titleFromArgs = command.property(forKey: "name") as? String + let (account, folder) = command.accountAndFolderForNewChild() + guard let url = self.urlForNewFeed(arguments: arguments) else { return nil } - if let existingFeed = account.existingFeed(withURL: url) { - return scriptableFeed(existingFeed, account:account, folder:folder).objectSpecifier - } + if let existingFeed = account.existingFeed(withURL: url) { + return scriptableFeed(existingFeed, account: account, folder: folder).objectSpecifier + } let container: Container = folder != nil ? folder! : account - // We need to download the feed and parse it. - // RSParser does the callback for the download on the main thread. - // Because we can't wait here (on the main thread) for the callback, we have to return from this function. - // Generally, returning from an AppleEvent handler function means that handling the Apple event is over, - // but we don’t yet have the result of the event yet, so we prevent the Apple event from returning by calling - // suspendExecution(). When we get the callback, we supply the event result and call resumeExecution(). - command.suspendExecution() + // We need to download the feed and parse it. + // RSParser does the callback for the download on the main thread. + // Because we can't wait here (on the main thread) for the callback, we have to return from this function. + // Generally, returning from an AppleEvent handler function means that handling the Apple event is over, + // but we don’t yet have the result of the event yet, so we prevent the Apple event from returning by calling + // suspendExecution(). When we get the callback, we supply the event result and call resumeExecution(). + command.suspendExecution() account.createFeed(url: url, name: titleFromArgs, container: container, validateFeed: true) { result in switch result { @@ -140,73 +140,73 @@ import Articles } - return nil - } + return nil + } - // MARK: --- Scriptable properties --- + // MARK: - Scriptable properties - @objc(url) - var url: String { - feed.url - } + @objc(url) + var url: String { + feed.url + } - @objc(name) - var name: String { - feed.name ?? "" - } + @objc(name) + var name: String { + feed.name ?? "" + } - @objc(homePageURL) - var homePageURL: String { + @objc(homePageURL) + var homePageURL: String { feed.homePageURL ?? "" - } + } - @objc(iconURL) - var iconURL: String { - feed.iconURL ?? "" - } + @objc(iconURL) + var iconURL: String { + feed.iconURL ?? "" + } - @objc(faviconURL) - var faviconURL: String { - feed.faviconURL ?? "" - } + @objc(faviconURL) + var faviconURL: String { + feed.faviconURL ?? "" + } - @objc(opmlRepresentation) - var opmlRepresentation: String { - feed.OPMLString(indentLevel:0) - } + @objc(opmlRepresentation) + var opmlRepresentation: String { + feed.OPMLString(indentLevel: 0) + } - // MARK: --- scriptable elements --- + // MARK: - Scriptable elements - @objc(authors) - var authors: NSArray { - let feedAuthors = feed.authors ?? [] - return feedAuthors.map { ScriptableAuthor($0, container:self) } as NSArray - } + @objc(authors) + var authors: NSArray { + let feedAuthors = feed.authors ?? [] + return feedAuthors.map { ScriptableAuthor($0, container: self) } as NSArray + } - @objc(valueInAuthorsWithUniqueID:) - func valueInAuthors(withUniqueID id: String) -> ScriptableAuthor? { + @objc(valueInAuthorsWithUniqueID:) + func valueInAuthors(withUniqueID id: String) -> ScriptableAuthor? { guard let author = feed.authors?.first(where: {$0.authorID == id}) else { return nil } - return ScriptableAuthor(author, container:self) - } + return ScriptableAuthor(author, container: self) + } - @objc(articles) - var articles: NSArray { - let feedArticles = (try? feed.fetchArticles()) ?? Set
() - // the articles are a set, use the sorting algorithm from the viewer - let sortedArticles = feedArticles.sorted(by: { - return $0.logicalDatePublished > $1.logicalDatePublished - }) - return sortedArticles.map { ScriptableArticle($0, container:self) } as NSArray - } + @objc(articles) + var articles: NSArray { + let feedArticles = (try? feed.fetchArticles()) ?? Set
() + // the articles are a set, use the sorting algorithm from the viewer + let sortedArticles = feedArticles.sorted(by: { + return $0.logicalDatePublished > $1.logicalDatePublished + }) + return sortedArticles.map { ScriptableArticle($0, container: self) } as NSArray + } - @objc(valueInArticlesWithUniqueID:) - func valueInArticles(withUniqueID id: String) -> ScriptableArticle? { - let articles = (try? feed.fetchArticles()) ?? Set
() + @objc(valueInArticlesWithUniqueID:) + func valueInArticles(withUniqueID id: String) -> ScriptableArticle? { + let articles = (try? feed.fetchArticles()) ?? Set
() guard let article = articles.first(where: {$0.uniqueID == id}) else { return nil } - return ScriptableArticle(article, container: self) - } + return ScriptableArticle(article, container: self) + } } diff --git a/Mac/Scripting/NSApplication+Scriptability.swift b/Mac/Scripting/NSApplication+Scriptability.swift index 72d6ed62f..3d6600324 100644 --- a/Mac/Scripting/NSApplication+Scriptability.swift +++ b/Mac/Scripting/NSApplication+Scriptability.swift @@ -11,9 +11,8 @@ import Account import Articles extension NSApplication : @preconcurrency ScriptingObjectContainer { - - // MARK: --- ScriptingObjectContainer protocol --- - + // MARK: - ScriptingObjectContainer protocol + nonisolated var scriptingClassDescription: NSScriptClassDescription { return self.classDescription as! NSScriptClassDescription } @@ -137,5 +136,3 @@ extension NSApplication : @preconcurrency ScriptingObjectContainer { return ScriptableFeed(feed, container:self) } } - - diff --git a/Mac/Scripting/NSScriptCommand+NetNewsWire.swift b/Mac/Scripting/NSScriptCommand+NetNewsWire.swift index bf989de7a..763e67d68 100644 --- a/Mac/Scripting/NSScriptCommand+NetNewsWire.swift +++ b/Mac/Scripting/NSScriptCommand+NetNewsWire.swift @@ -29,7 +29,7 @@ import Account func accountAndFolderForNewChild() -> (Account, Folder?) { let appleEvent = self.appleEvent var account = AccountManager.shared.defaultAccount - var folder:Folder? = nil + var folder:Folder? if let appleEvent = appleEvent { var descriptorToConsider:NSAppleEventDescriptor? if let insertionLocationDescriptor = appleEvent.paramDescriptor(forKeyword:keyAEInsertHere) { diff --git a/Modules/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift b/Modules/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift index 4b06e0c1b..c75b526dd 100644 --- a/Modules/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift +++ b/Modules/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift @@ -25,7 +25,7 @@ import os downloadSession.downloadProgress } - private var completion: (() -> Void)? = nil + private var completion: (() -> Void)? private var isSuspended = false private lazy var downloadSession: DownloadSession = { @@ -195,7 +195,6 @@ import os } } - // MARK: - Private private extension LocalAccountRefresher { diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift index 04fc5386a..aebfcca89 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift @@ -111,7 +111,7 @@ final class ArticlesTable: DatabaseTable, Sendable { func fetchArticlesMatching(_ searchString: String) throws -> Set
{ nonisolated(unsafe) var articles: Set
= Set
() - nonisolated(unsafe) var error: DatabaseError? = nil + nonisolated(unsafe) var error: DatabaseError? queue.runInDatabaseSync { (databaseResult) in switch databaseResult { @@ -181,7 +181,7 @@ final class ArticlesTable: DatabaseTable, Sendable { let authorsNames = row.string(forColumn: DatabaseKey.authors) let searchRowIDObject = row.object(forColumnName: DatabaseKey.searchRowID) - var searchRowID: Int? = nil + var searchRowID: Int? if searchRowIDObject != nil && !(searchRowIDObject is NSNull) { searchRowID = Int(row.longLongInt(forColumn: DatabaseKey.searchRowID)) } @@ -401,7 +401,6 @@ final class ArticlesTable: DatabaseTable, Sendable { return unreadCountDictionary } - switch databaseResult { case .success(let database): do { @@ -717,7 +716,7 @@ nonisolated private extension ArticlesTable { private func fetchArticles(_ fetchMethod: @escaping ArticlesFetchMethod) throws -> Set
{ nonisolated(unsafe) var articles = Set
() - nonisolated(unsafe) var error: DatabaseError? = nil + nonisolated(unsafe) var error: DatabaseError? queue.runInDatabaseSync { databaseResult in switch databaseResult { @@ -1053,7 +1052,6 @@ nonisolated private extension ArticlesTable { return updatedArticles } - func saveUpdatedArticles(_ updatedArticles: Set
, _ fetchedArticles: [String: Article], _ database: FMDatabase) { saveUpdatedRelatedObjects(updatedArticles, fetchedArticles, database) diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/AuthorsTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/AuthorsTable.swift index 125de1ded..e2a4503b3 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/AuthorsTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/AuthorsTable.swift @@ -17,7 +17,6 @@ import Articles // CREATE TABLE if not EXISTS authors (authorID TEXT NOT NULL PRIMARY KEY, name TEXT, url TEXT, avatarURL TEXT, emailAddress TEXT); // CREATE TABLE if not EXISTS authorLookup (authorID TEXT NOT NULL, articleID TEXT NOT NULL, PRIMARY KEY(authorID, articleID)); - final class AuthorsTable: DatabaseRelatedObjectsTable, Sendable { let name: String let databaseIDKey = DatabaseKey.authorID @@ -36,4 +35,3 @@ final class AuthorsTable: DatabaseRelatedObjectsTable, Sendable { return nil } } - diff --git a/Modules/CloudKitSync/Sources/CloudKitSync/CloudKitZone.swift b/Modules/CloudKitSync/Sources/CloudKitSync/CloudKitZone.swift index 08c2913ff..ddd570625 100644 --- a/Modules/CloudKitSync/Sources/CloudKitSync/CloudKitZone.swift +++ b/Modules/CloudKitSync/Sources/CloudKitSync/CloudKitZone.swift @@ -312,7 +312,6 @@ public extension CloudKitZone { database?.add(op) } - /// Fetch a CKRecord by using its externalID func fetch(externalID: String?, completion: @escaping (Result) -> Void) { guard let externalID else { diff --git a/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift b/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift index 6736afabf..e6b0c6bc8 100644 --- a/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift +++ b/Modules/FeedFinder/Sources/FeedFinder/FeedSpecifier.swift @@ -62,7 +62,7 @@ public struct FeedSpecifier: Hashable, Sendable { } var currentHighScore = Int.min - var currentBestFeed: FeedSpecifier? = nil + var currentBestFeed: FeedSpecifier? for oneFeedSpecifier in feedSpecifiers { let oneScore = oneFeedSpecifier.score diff --git a/Modules/RSCore/Sources/RSCore/AppKit/RSAppMovementMonitor.swift b/Modules/RSCore/Sources/RSCore/AppKit/RSAppMovementMonitor.swift index 13ee53740..ddeb22f11 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/RSAppMovementMonitor.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/RSAppMovementMonitor.swift @@ -14,11 +14,11 @@ import Cocoa // If provided, the handler will be consulted when the app is moved. // Return true to indicate that the default handler should be invoked. - public var appMovementHandler: ((RSAppMovementMonitor) -> Bool)? = nil + public var appMovementHandler: ((RSAppMovementMonitor) -> Bool)? // DispatchSource offers a monitoring mechanism based on an open file descriptor var fileDescriptor: Int32 = -1 - var dispatchSource: DispatchSourceFileSystemObject? = nil + var dispatchSource: DispatchSourceFileSystemObject? // Save the original location of the app in a file reference URL, which will track its new location. // Note this is NSURL, not URL, because file reference URLs violate value-type assumptions of URL. diff --git a/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift b/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift index 503770b33..7246a42d1 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift @@ -15,10 +15,10 @@ import AppKit public final class UserApp { public let bundleID: String - public var icon: NSImage? = nil + public var icon: NSImage? public var existsOnDisk = false - public var path: String? = nil - public var runningApplication: NSRunningApplication? = nil + public var path: String? + public var runningApplication: NSRunningApplication? public var isRunning: Bool { updateStatus() diff --git a/Modules/RSCore/Sources/RSCore/RSImage.swift b/Modules/RSCore/Sources/RSCore/RSImage.swift index 66f33bf4c..1e2c10ec4 100644 --- a/Modules/RSCore/Sources/RSCore/RSImage.swift +++ b/Modules/RSCore/Sources/RSCore/RSImage.swift @@ -152,9 +152,9 @@ public extension RSImage { return nil } - var exactMatch: (index: Int, maxDimension: Int)? = nil - var goodMatch: (index: Int, maxDimension: Int)? = nil - var smallMatch: (index: Int, maxDimension: Int)? = nil + var exactMatch: (index: Int, maxDimension: Int)? + var goodMatch: (index: Int, maxDimension: Int)? + var smallMatch: (index: Int, maxDimension: Int)? // Single pass through all images to find the best match for i in 0.. [AnyObject] { diff --git a/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift b/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift index 636cd0790..2eee65b71 100644 --- a/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift +++ b/Modules/RSWeb/Sources/RSWeb/SpecialCases.swift @@ -25,7 +25,6 @@ nonisolated public struct SpecialCase { } } - nonisolated extension URL { public var isOpenRSSOrgURL: Bool { diff --git a/iOS/Account/FeedbinAccountViewController.swift b/iOS/Account/FeedbinAccountViewController.swift index e06ccb008..9e0d8a4f9 100644 --- a/iOS/Account/FeedbinAccountViewController.swift +++ b/iOS/Account/FeedbinAccountViewController.swift @@ -148,7 +148,6 @@ final class FeedbinAccountViewController: UITableViewController { self.present(safari, animated: true, completion: nil) } - @objc func textDidChange(_ note: Notification) { actionButton.isEnabled = !(emailTextField.text?.isEmpty ?? false) && !(passwordTextField.text?.isEmpty ?? false) } @@ -170,7 +169,6 @@ final class FeedbinAccountViewController: UITableViewController { activityIndicator.stopAnimating() } } - } extension FeedbinAccountViewController: UITextFieldDelegate { @@ -184,5 +182,4 @@ extension FeedbinAccountViewController: UITextFieldDelegate { } return true } - } diff --git a/iOS/Account/ReaderAPIAccountViewController.swift b/iOS/Account/ReaderAPIAccountViewController.swift index fa306770a..61a15c151 100644 --- a/iOS/Account/ReaderAPIAccountViewController.swift +++ b/iOS/Account/ReaderAPIAccountViewController.swift @@ -116,7 +116,6 @@ final class ReaderAPIAccountViewController: UITableViewController { } } - @IBAction func cancel(_ sender: Any) { dismiss(animated: true, completion: nil) } @@ -278,8 +277,6 @@ final class ReaderAPIAccountViewController: UITableViewController { } } - - @objc func textDidChange(_ note: Notification) { actionButton.isEnabled = !(usernameTextField.text?.isEmpty ?? false) } @@ -315,5 +312,4 @@ extension ReaderAPIAccountViewController: UITextFieldDelegate { textField.resignFirstResponder() return true } - } diff --git a/iOS/Article/ArticleSearchBar.swift b/iOS/Article/ArticleSearchBar.swift index 32eac6f1e..142482f1d 100644 --- a/iOS/Article/ArticleSearchBar.swift +++ b/iOS/Article/ArticleSearchBar.swift @@ -15,7 +15,6 @@ import UIKit @objc optional func searchBar(_ searchBar: ArticleSearchBar, textDidChange: String) } - @IBDesignable final class ArticleSearchBar: UIStackView { var searchField: UISearchTextField! var nextButton: UIButton! diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 43a9bf6e4..254b8ac56 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -428,7 +428,6 @@ extension ArticleViewController { } - // MARK: WebViewControllerDelegate extension ArticleViewController: WebViewControllerDelegate { diff --git a/iOS/Article/ImageScrollView.swift b/iOS/Article/ImageScrollView.swift index d265e2e3d..2ed5b3ed7 100644 --- a/iOS/Article/ImageScrollView.swift +++ b/iOS/Article/ImageScrollView.swift @@ -238,7 +238,6 @@ open class ImageScrollView: UIScrollView { minScale = yScale } - let maxScale = maxScaleFromMinScale*minScale // don't let minScale exceed maxScale. (If the image is smaller than the screen, we don't want to force it to be zoomed.) diff --git a/iOS/Article/ImageViewController.swift b/iOS/Article/ImageViewController.swift index d2e4835fc..16e95c206 100644 --- a/iOS/Article/ImageViewController.swift +++ b/iOS/Article/ImageViewController.swift @@ -95,6 +95,4 @@ extension ImageViewController: ImageScrollViewDelegate { func imageScrollViewDidGestureSwipeDown(imageScrollView: ImageScrollView) { dismiss(animated: true) } - - } diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 44bfb324c..318080ecf 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -505,11 +505,8 @@ extension WebViewController: UIScrollViewDelegate { self.windowScrollY = javascriptScrollY } } - } - - // MARK: JSON private struct ImageClickMessage: Codable { diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift index 1e4b2e97e..6dba0814b 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift @@ -43,7 +43,6 @@ final class MainFeedCollectionHeaderReusableView: UICollectionReusableView { } } - private var _unreadCount: Int = 0 var unreadCount: Int { diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift index 2acb76f17..5c0e1c6dc 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift @@ -11,8 +11,7 @@ import RSCore import Account import RSTree - -class MainFeedCollectionViewCell: UICollectionViewCell { +final class MainFeedCollectionViewCell: UICollectionViewCell { @IBOutlet var feedTitle: UILabel! @IBOutlet var faviconView: IconView! @IBOutlet var unreadCountLabel: UILabel! @@ -115,6 +114,5 @@ class MainFeedCollectionViewCell: UICollectionViewCell { } self.backgroundConfiguration = backgroundConfig } - } diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift index 438b4d190..7db3bb55e 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift @@ -97,7 +97,6 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell { disclosureExpanded = isExpanded } - override var accessibilityLabel: String? { set {} get { @@ -137,5 +136,4 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell { self.backgroundConfiguration = backgroundConfig } - } diff --git a/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift b/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift index 97b437dcd..d5ab86e2d 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController+Drag.swift @@ -34,7 +34,4 @@ extension MainFeedCollectionViewController: UICollectionViewDragDelegate { dragItem.localObject = node return [dragItem] } - - - } diff --git a/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift b/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift index 97a24bd89..72e51d2d9 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController+Drop.swift @@ -16,7 +16,6 @@ import RSWeb import SafariServices import UniformTypeIdentifiers - extension MainFeedCollectionViewController: UICollectionViewDropDelegate { func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: any UICollectionViewDropCoordinator) { diff --git a/iOS/MainFeed/MainFeedCollectionViewController.swift b/iOS/MainFeed/MainFeedCollectionViewController.swift index d84ba31dd..3760e8d60 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController.swift @@ -57,7 +57,6 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab /// `viewDidAppear(_:)` after a delay to allow the deselection animation to complete. private var isAnimating: Bool = false - override func viewDidLoad() { super.viewDidLoad() registerForNotifications() @@ -228,7 +227,6 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab return coordinator.numberOfSections() } - override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { // #warning Incomplete implementation, return the number of items return coordinator.numberOfRows(in: section) @@ -259,7 +257,6 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab for: indexPath ) as! MainFeedCollectionHeaderReusableView - guard let nameProvider = coordinator.rootNode.childAtIndex(indexPath.section)?.representedObject as? DisplayNameProvider else { return UICollectionReusableView() } @@ -301,16 +298,13 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } */ - // Uncomment this method to specify if the specified item should be selected override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { if traitCollection.userInterfaceIdiom == .pad { return true } return !isAnimating } - - - override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool { + override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool { return true } @@ -339,7 +333,7 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab // MARK: - Key Commands - // MARK: Keyboard shortcuts + // MARK: - Keyboard shortcuts @objc func collapseAllExceptForGroupItems(_ sender: Any?) { coordinator.collapseAllFolders() @@ -404,8 +398,6 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab coordinator.showFeedInspector() } - - // MARK: - API func focus() { @@ -420,11 +412,9 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } addNewItemButton?.isEnabled = !AccountManager.shared.activeAccounts.isEmpty - configureContextMenu() } - func updateFeedSelection(animations: Animations) { if let indexPath = coordinator.currentFeedIndexPath { collectionView.selectItemAndScrollIfNotVisible(at: indexPath, animations: animations) @@ -550,10 +540,8 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } } - // MARK: - Private - /// Configure standard feed cells func configure(_ cell: MainFeedCollectionViewCell, indexPath: IndexPath) { guard let node = coordinator.nodeFor(indexPath) else { return } @@ -612,11 +600,8 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab filterButton?.accLabelText = NSLocalizedString("Filter Read Feeds", comment: "Filter Read Feeds") } - - // MARK: - Notifications - @objc func preferredContentSizeCategoryDidChange() { IconImageCache.shared.emptyCache() reloadAllVisibleCells() @@ -670,8 +655,8 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab } // MARK: - Actions - @objc - func configureContextMenu(_: Any? = nil) { + + @objc func configureContextMenu(_: Any? = nil) { /* Context Menu Order: 1. Add Feed @@ -735,12 +720,10 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab present(alertController, animated: true) } - @IBAction func toggleFilter(_ sender: Any) { coordinator.toggleReadFeedsFilter() } - func toggle(_ headerView: MainFeedCollectionHeaderReusableView) { guard let sectionNode = coordinator.rootNode.childAtIndex(headerView.tag) else { return @@ -754,17 +737,14 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab coordinator.expand(sectionNode) } } - } extension MainFeedCollectionViewController: MainFeedCollectionHeaderReusableViewDelegate { func mainFeedCollectionHeaderReusableViewDidTapDisclosureIndicator(_ view: MainFeedCollectionHeaderReusableView) { toggle(view) } - } - extension MainFeedCollectionViewController: MainFeedCollectionViewFolderCellDelegate { func mainFeedCollectionFolderViewCellDisclosureDidToggle(_ sender: MainFeedCollectionViewFolderCell, expanding: Bool) { if expanding { @@ -774,7 +754,6 @@ extension MainFeedCollectionViewController: MainFeedCollectionViewFolderCellDele } } - func expand(_ cell: MainFeedCollectionViewFolderCell) { guard let indexPath = collectionView.indexPath(for: cell), let node = coordinator.nodeFor(indexPath) else { return @@ -788,12 +767,8 @@ extension MainFeedCollectionViewController: MainFeedCollectionViewFolderCellDele } coordinator.collapse(node) } - - - } - extension MainFeedCollectionViewController: UIContextMenuInteractionDelegate { func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { @@ -825,12 +800,8 @@ extension MainFeedCollectionViewController: UIContextMenuInteractionDelegate { let cell = collectionView.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: IndexPath(item: 0, section: sectionIndex)) as? MainFeedCollectionHeaderReusableView else { return nil } - - return UITargetedPreview(view: cell, parameters: CroppingPreviewParameters(view: cell)) } - - } extension MainFeedCollectionViewController { @@ -874,9 +845,7 @@ extension MainFeedCollectionViewController { } return UIMenu(title: "", children: menuElements) - }) - } func makeFolderContextMenu(indexPath: IndexPath) -> UIContextMenuConfiguration { @@ -1006,7 +975,6 @@ extension MainFeedCollectionViewController { completion(true) } - let action = UIAlertAction(title: title, style: .default) { [weak self] action in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView, cancelCompletion: cancel) { [weak self] in self?.coordinator.markAllAsRead(Array(articles)) @@ -1115,7 +1083,6 @@ extension MainFeedCollectionViewController { return action } - func rename(indexPath: IndexPath) { guard let sidebarItem = coordinator.nodeFor(indexPath)?.representedObject as? SidebarItem else { return } @@ -1222,4 +1189,3 @@ extension MainFeedCollectionViewController { deleteCommand.perform() } } - diff --git a/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift b/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift index 677c3f3be..e2d65d018 100644 --- a/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift @@ -144,6 +144,4 @@ class MainTimelineFeedCell: UITableViewCell { self.backgroundConfiguration = backgroundConfig } - - } diff --git a/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift b/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift index 19e62980a..17334af29 100644 --- a/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift @@ -46,7 +46,6 @@ class MainTimelineIconFeedCell: UITableViewCell { } } - private func configure(_ cellData: MainTimelineCellData) { updateIndicatorView(cellData) articleTitle.numberOfLines = cellData.numberOfLines @@ -117,8 +116,6 @@ class MainTimelineIconFeedCell: UITableViewCell { private func applyTitleTextWithAttributes(_ state: UICellConfigurationState) { let attributedCellText = NSMutableAttributedString() - - let isSelected = state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped if cellData.title != "" { let paragraphStyle = NSMutableParagraphStyle() diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index 79dd949f8..177e9fd9a 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -1018,7 +1018,6 @@ private extension MainTimelineViewController { return nil } - let localizedMenuText = NSLocalizedString("Mark All as Read in “%@”", comment: "Command") let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, feed.nameForDisplay) as String diff --git a/iOS/MainTimeline/MarkAsReadAlertController.swift b/iOS/MainTimeline/MarkAsReadAlertController.swift index c7425d8df..2d89a8fb8 100644 --- a/iOS/MainTimeline/MarkAsReadAlertController.swift +++ b/iOS/MainTimeline/MarkAsReadAlertController.swift @@ -14,7 +14,6 @@ extension CGRect: MarkAsReadAlertControllerSourceType {} extension UIView: MarkAsReadAlertControllerSourceType {} extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {} - @MainActor struct MarkAsReadAlertController { static func confirm(_ controller: UIViewController?, @@ -45,7 +44,6 @@ extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {} sourceType: T, completion: @escaping (UIAlertAction) -> Void) -> UIAlertController where T: MarkAsReadAlertControllerSourceType { - let title = NSLocalizedString("Mark As Read", comment: "Mark As Read") let message = NSLocalizedString("You can turn this confirmation off in Settings.", comment: "You can turn this confirmation off in Settings.") diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 07baf05e0..2ed9040e2 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -583,7 +583,6 @@ struct FeedNode: Hashable, Sendable { } } - /// Updates navigation bar subtitles in response to feed selection, unread count changes, /// `combinedRefreshProgressDidChange` notifications, and a timed refresh every /// 60s. @@ -906,7 +905,6 @@ struct FeedNode: Hashable, Sendable { currentFeedIndexPath = indexPath mainFeedCollectionViewController.updateFeedSelection(animations: animations) - if deselectArticle { selectArticle(nil) } @@ -937,7 +935,6 @@ struct FeedNode: Hashable, Sendable { } updateNavigationBarSubtitles(nil) - } func selectPrevFeed() { @@ -2291,7 +2288,6 @@ private extension SceneCoordinator { let isShowingExtractedArticle = AppDefaults.shared.isShowingExtractedArticle let articleWindowScrollY = AppDefaults.shared.articleWindowScrollY - switch sidebarItemID { case .smartFeed, .folder: diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 25e2240f4..36bf3b906 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -214,8 +214,6 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { } else { return } - - } } } diff --git a/iOS/Settings/ModernTimelineCustomizerTableViewController.swift b/iOS/Settings/ModernTimelineCustomizerTableViewController.swift index ac5a21dae..27a80493f 100644 --- a/iOS/Settings/ModernTimelineCustomizerTableViewController.swift +++ b/iOS/Settings/ModernTimelineCustomizerTableViewController.swift @@ -83,7 +83,6 @@ final class ModernTimelineCustomizerTableViewController: UITableViewController { return cell } - if indexPath.section == 2 { let cell = tableView.dequeueReusableCell(withIdentifier: "MainTimelineIconFeedCell") as? MainTimelineIconFeedCell ?? MainTimelineIconFeedCell() cell.cellData = MainTimelineCellData(article: previewArticle, diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 5a6af4e03..5db724337 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -318,8 +318,7 @@ final class SettingsViewController: UITableViewController { AppDefaults.shared.isArticleContentJavascriptEnabled = enableJavaScriptSwitch.isOn } - - // MARK: Notifications + // MARK: - Notifications @objc func contentSizeCategoryDidChange() { tableView.reloadData() @@ -339,7 +338,7 @@ final class SettingsViewController: UITableViewController { } -// MARK: OPML Document Picker +// MARK: - OPML Document Picker extension SettingsViewController: UIDocumentPickerDelegate { @@ -360,7 +359,7 @@ extension SettingsViewController: UIDocumentPickerDelegate { } -// MARK: Private +// MARK: - Private private extension SettingsViewController { diff --git a/iOS/ShareExtension/ShareViewController.swift b/iOS/ShareExtension/ShareViewController.swift index 12969a200..2cceface5 100644 --- a/iOS/ShareExtension/ShareViewController.swift +++ b/iOS/ShareExtension/ShareViewController.swift @@ -36,7 +36,6 @@ final class ShareViewController: SLComposeServiceViewController, ShareFolderPick } override func viewDidLoad() { - extensionContainers = ExtensionContainersFile.read() flattenedContainers = extensionContainers?.flattened ?? [ExtensionContainer]() if let extensionContainers { @@ -115,7 +114,7 @@ final class ShareViewController: SLComposeServiceViewController, ShareFolderPick } override func didSelectPost() { - guard let url = url, let selectedContainer = selectedContainer, let containerID = selectedContainer.containerID else { + guard let url, let selectedContainer, let containerID = selectedContainer.containerID else { self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) return } @@ -139,7 +138,6 @@ final class ShareViewController: SLComposeServiceViewController, ShareFolderPick } override func configurationItems() -> [Any]! { - // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. guard let urlItem = SLComposeSheetConfigurationItem() else { return nil } urlItem.title = "URL" @@ -165,7 +163,6 @@ final class ShareViewController: SLComposeServiceViewController, ShareFolderPick return [folderItem!, urlItem] } - } private extension ShareViewController { @@ -177,5 +174,4 @@ private extension ShareViewController { self.folderItem.value = "\(folder.accountName) / \(folder.name)" } } - }