Fix various SwiftLint warnings.

This commit is contained in:
Brent Simmons committed 2026-01-01 18:07:54 -08:00
1 parent 0832a7cf67
commit dbaa8142e1
19 files changed
+31 -41

No files matched your search

@@ -23,7 +23,6 @@ import RSParser
// display error sheet.
@MainActor final class AddFeedController: AddFeedWindowControllerDelegate {
private let hostWindow: NSWindow
private var addFeedWindowController: AddFeedWindowController?
private var foundFeedURLString: String?
@@ -47,7 +46,7 @@ import RSParser
windowController.runSheetOnWindow(hostWindow)
}
// MARK: AddFeedWindowControllerDelegate
// MARK: - AddFeedWindowControllerDelegate
func addFeedWindowController(_: AddFeedWindowController, userEnteredURL url: URL, userEnteredTitle title: String?, container: Container) {
closeAddFeedSheet(NSApplication.ModalResponse.OK)
@@ -92,11 +91,9 @@ import RSParser
func addFeedWindowControllerUserDidCancel(_: AddFeedWindowController) {
closeAddFeedSheet(NSApplication.ModalResponse.cancel)
}
}
private extension AddFeedController {
var urlStringFromPasteboard: String? {
if let urlString = NSPasteboard.urlString(from: NSPasteboard.general) {
return urlString.normalizedURL
@@ -125,7 +122,7 @@ private extension AddFeedController {
}
}
// MARK: Errors
// MARK: - Errors
func showAlreadySubscribedError(_ urlString: String) {
let alert = NSAlert()
@@ -154,16 +151,14 @@ private extension AddFeedController {
alert.beginSheetModal(for: hostWindow)
}
// MARK: Progress
// MARK: - Progress
func beginShowingProgress() {
IndeterminateProgressController.beginProgressWithMessage(NSLocalizedString("Finding feed…", comment:"Feed finder"))
IndeterminateProgressController.beginProgressWithMessage(NSLocalizedString("Finding feed…", comment: "Feed finder"))
}
func endShowingProgress() {
IndeterminateProgressController.endProgress()
hostWindow.makeKeyAndOrderFront(self)
}
}
@@ -10,7 +10,7 @@ import AppKit
import Articles
import Account
final class AddFolderWindowController : NSWindowController {
final class AddFolderWindowController: NSWindowController {
@IBOutlet var folderNameTextField: NSTextField!
@IBOutlet var accountPopupButton: NSPopUpButton!
+4 -6
View File
@@ -16,8 +16,7 @@ enum TimelineSourceMode {
case regular, search
}
final class MainWindowController : NSWindowController, NSUserInterfaceValidations {
final class MainWindowController: NSWindowController, NSUserInterfaceValidations {
@IBOutlet var articleThemePopUpButton: NSPopUpButton?
private var activityManager = ActivityManager()
@@ -118,14 +117,14 @@ final class MainWindowController : NSWindowController, NSUserInterfaceValidation
func handle(_ response: UNNotificationResponse) {
let userInfo = response.notification.request.content.userInfo
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable : Any] else { return }
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable: Any] else { return }
sidebarViewController?.deepLinkRevealAndSelect(for: articlePathUserInfo)
currentTimelineViewController?.goToDeepLink(for: articlePathUserInfo)
}
func handle(_ activity: NSUserActivity) {
guard let userInfo = activity.userInfo else { return }
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable : Any] else { return }
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable: Any] else { return }
sidebarViewController?.deepLinkRevealAndSelect(for: articlePathUserInfo)
currentTimelineViewController?.goToDeepLink(for: articlePathUserInfo)
}
@@ -741,8 +740,7 @@ extension MainWindowController: ArticleExtractorDelegate {
but for now, we'll keep the stratification of visibility
*/
extension MainWindowController : ScriptingMainWindowController {
extension MainWindowController: ScriptingMainWindowController {
internal var scriptingCurrentArticle: Article? {
return self.oneSelectedArticle
}
@@ -11,7 +11,7 @@ import RSCore
import Account
import RSTree
final class SidebarCell : NSTableCellView {
final class SidebarCell: NSTableCellView {
var iconImage: IconImage? {
didSet {
@@ -374,7 +374,7 @@ private extension SidebarOutlineDataSource {
guard let sourceAccountID = pasteboardFeed.accountID,
let sourceAccount = AccountManager.shared.existingAccount(accountID: sourceAccountID),
let feedID = pasteboardFeed.feedID,
let feed = sourceAccount.existingFeed(withFeedID: feedID),
let feed = sourceAccount.existingFeed(withFeedID: feedID),
let destinationContainer = parentNode.representedObject as? Container
else {
return
@@ -10,7 +10,7 @@ import AppKit
import RSCore
import RSTree
final class SidebarOutlineView : NSOutlineView {
final class SidebarOutlineView: NSOutlineView {
@IBOutlet var keyboardDelegate: KeyboardDelegate!
@@ -9,14 +9,13 @@
import Foundation
final class SidebarWindowState: NSObject, NSSecureCoding {
static let supportsSecureCoding = true
let isReadFiltered: Bool
let expandedContainers: [[String: String]]
let selectedFeeds: [[String: String]]
init(isReadFiltered: Bool, expandedContainers: [[String : String]], selectedFeeds: [[String : String]]) {
init(isReadFiltered: Bool, expandedContainers: [[String: String]], selectedFeeds: [[String: String]]) {
self.isReadFiltered = isReadFiltered
self.expandedContainers = expandedContainers
self.selectedFeeds = selectedFeeds
+1 -1
View File
@@ -8,7 +8,7 @@
import AppKit
final class UnreadCountView : NSView {
final class UnreadCountView: NSView {
@MainActor struct Appearance {
static let padding = NSEdgeInsets(top: 1.0, left: 7.0, bottom: 1.0, right: 7.0)
static let cornerRadius: CGFloat = 8.0
@@ -8,7 +8,7 @@
import AppKit
final class TimelineTableRowView : NSTableRowView {
final class TimelineTableRowView: NSTableRowView {
private var separator: NSView?
@@ -17,7 +17,7 @@ final class TimelineWindowState: NSObject, NSSecureCoding {
let selectedAccountID: String?
let selectedArticleID: String?
init(readArticlesFilterStateKeys: [[String : String]], readArticlesFilterStateValues: [Bool], selectedAccountID: String? = nil, selectedArticleID: String? = nil) {
init(readArticlesFilterStateKeys: [[String: String]], readArticlesFilterStateValues: [Bool], selectedAccountID: String? = nil, selectedArticleID: String? = nil) {
self.readArticlesFilterStateKeys = readArticlesFilterStateKeys
self.readArticlesFilterStateValues = readArticlesFilterStateValues
self.selectedAccountID = selectedAccountID
@@ -156,7 +156,7 @@ final class FeedbinAccountViewController: UITableViewController {
presentError(title: NSLocalizedString("Error", comment: "Credentials Error"), message: message)
}
private func setNavigationEnabled(to value:Bool){
private func setNavigationEnabled(to value: Bool) {
cancelBarButtonItem.isEnabled = value
actionButton.isEnabled = value
}
+2 -2
View File
@@ -374,7 +374,7 @@ final class AppDefaults: Sendable {
}
@MainActor static func registerDefaults() {
let defaults: [String : Any] = [Key.userInterfaceColorPalette: UserInterfaceColorPalette.automatic.rawValue,
let defaults: [String: Any] = [Key.userInterfaceColorPalette: UserInterfaceColorPalette.automatic.rawValue,
Key.timelineGroupByFeed: false,
Key.refreshClearsReadArticles: false,
Key.timelineNumberOfLines: 2,
@@ -432,7 +432,7 @@ private extension AppDefaults {
AppDefaults.store.set(date, forKey: key)
}
static func sortDirection(for key:String) -> ComparisonResult {
static func sortDirection(for key: String) -> ComparisonResult {
let rawInt = int(for: key)
if rawInt == ComparisonResult.orderedAscending.rawValue {
return .orderedAscending
+3 -3
View File
@@ -82,7 +82,7 @@ import Secrets
self.updateBadge()
}
UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .sound, .alert]) { (granted, error) in
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .sound, .alert]) { (granted, error) in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
@@ -106,7 +106,7 @@ import Secrets
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Task { @MainActor in
self.resumeDatabaseProcessingIfNecessary()
await AccountManager.shared.receiveRemoteNotification(userInfo: userInfo)
@@ -410,7 +410,7 @@ private extension AppDelegate {
}
private func handleStatusNotification(userInfo: [AnyHashable: Any], statusKey: ArticleStatus.Key) {
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable : Any],
guard let articlePathUserInfo = userInfo[UserInfoKey.articlePath] as? [AnyHashable: Any],
let accountID = articlePathUserInfo[ArticlePathKey.accountID] as? String,
let articleID = articlePathUserInfo[ArticlePathKey.articleID] as? String else {
return
+1 -1
View File
@@ -146,7 +146,7 @@ open class ImageScrollView: UIScrollView {
}
private func maximumContentOffset() -> CGPoint {
return CGPoint(x: contentSize.width - bounds.width,y:contentSize.height - bounds.height)
CGPoint(x: contentSize.width - bounds.width, y: contentSize.height - bounds.height)
}
private func minimumContentOffset() -> CGPoint {
+2 -2
View File
@@ -48,7 +48,7 @@ final class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
UIView.animate(
withDuration: duration,
delay:0.0,
delay: 0.0,
usingSpringWithDamping: 0.8,
initialSpringVelocity: 0.2,
animations: {
@@ -87,7 +87,7 @@ final class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
UIView.animate(
withDuration: duration,
delay:0.0,
delay: 0.0,
usingSpringWithDamping: 0.8,
initialSpringVelocity: 0.2,
animations: {
+1 -1
View File
@@ -18,7 +18,7 @@ final class ArticleActivityItemSource: NSObject, UIActivityItemSource {
self.subject = subject
}
func activityViewControllerPlaceholderItem(_ : UIActivityViewController) -> Any {
func activityViewControllerPlaceholderItem(_: UIActivityViewController) -> Any {
return url
}
@@ -84,7 +84,7 @@ final class FeedInspectorViewController: UITableViewController {
} else if authorizationStatus == .authorized {
feed.isNotifyAboutNewArticles = notifyAboutNewArticlesSwitch.isOn
} else {
UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .sound, .alert]) { (granted, error) in
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .sound, .alert]) { (granted, error) in
Task { @MainActor in
self.updateNotificationSettings()
if granted {
@@ -215,7 +215,7 @@ extension FeedInspectorViewController {
let alert = UIAlertController(title: NSLocalizedString("Enable Notifications", comment: "Notifications"),
message: NSLocalizedString("Notifications need to be enabled in the Settings app.", comment: "Notifications need to be enabled in the Settings app."), preferredStyle: .alert)
let openSettings = UIAlertAction(title: NSLocalizedString("Open Settings", comment: "Open Settings"), style: .default) { (action) in
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly : false], completionHandler: nil)
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly: false], completionHandler: nil)
}
let dismiss = UIAlertAction(title: NSLocalizedString("Dismiss", comment: "Dismiss"), style: .cancel, handler: nil)
alert.addAction(openSettings)
@@ -8,11 +8,9 @@
import UIKit
final class MainTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType : Hashable, ItemIdentifierType : Hashable {
final class MainTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType: Hashable, ItemIdentifierType: Hashable {
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
true
}
}
@@ -17,7 +17,7 @@ final class MainTimelineViewController: UITableViewController, UndoableCommandRu
private var numberOfTextLines = 0
private var iconSize = IconSize.medium
private lazy var feedTapGestureRecognizer = UITapGestureRecognizer(target: self, action:#selector(showFeedInspector(_:)))
private lazy var feedTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(showFeedInspector(_:)))
private var refreshProgressView: RefreshProgressView?