Fix various SwiftLint warnings.

This commit is contained in:
Brent Simmons committed 2026-01-01 17:55:12 -08:00
1 parent 50140acac2
commit 0832a7cf67
52 files changed
+165 -282

No files matched your search

@@ -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
}
}
@@ -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
}
}
-1
View File
@@ -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!
-1
View File
@@ -428,7 +428,6 @@ extension ArticleViewController {
}
// MARK: WebViewControllerDelegate
extension ArticleViewController: WebViewControllerDelegate {
-1
View File
@@ -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.)
-2
View File
@@ -95,6 +95,4 @@ extension ImageViewController: ImageScrollViewDelegate {
func imageScrollViewDidGestureSwipeDown(imageScrollView: ImageScrollView) {
dismiss(animated: true)
}
}
-3
View File
@@ -505,11 +505,8 @@ extension WebViewController: UIScrollViewDelegate {
self.windowScrollY = javascriptScrollY
}
}
}
// MARK: JSON
private struct ImageClickMessage: Codable {
@@ -43,7 +43,6 @@ final class MainFeedCollectionHeaderReusableView: UICollectionReusableView {
}
}
private var _unreadCount: Int = 0
var unreadCount: Int {
@@ -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
}
}
@@ -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
}
}
@@ -34,7 +34,4 @@ extension MainFeedCollectionViewController: UICollectionViewDragDelegate {
dragItem.localObject = node
return [dragItem]
}
}
@@ -16,7 +16,6 @@ import RSWeb
import SafariServices
import UniformTypeIdentifiers
extension MainFeedCollectionViewController: UICollectionViewDropDelegate {
func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: any UICollectionViewDropCoordinator) {
@@ -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()
}
}
@@ -144,6 +144,4 @@ class MainTimelineFeedCell: UITableViewCell {
self.backgroundConfiguration = backgroundConfig
}
}
@@ -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()
@@ -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
@@ -14,7 +14,6 @@ extension CGRect: MarkAsReadAlertControllerSourceType {}
extension UIView: MarkAsReadAlertControllerSourceType {}
extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {}
@MainActor struct MarkAsReadAlertController {
static func confirm<T>(_ 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.")
-4
View File
@@ -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:
-2
View File
@@ -214,8 +214,6 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
} else {
return
}
}
}
}
@@ -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,
+3 -4
View File
@@ -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 {
+1 -5
View File
@@ -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)"
}
}
}