Make all senders parameters for actions optional — Any? instead of AnyObject or Any.

This commit is contained in:
Brent Simmons 2018-02-11 18:58:50 -08:00
parent 84a8cb1a0e
commit 1aac355418
9 changed files with 31 additions and 27 deletions

View File

@ -38,7 +38,7 @@ class MasterViewController: UITableViewController {
}
@objc
func insertNewObject(_ sender: Any) {
func insertNewObject(_ sender: Any?) {
objects.insert(NSDate(), at: 0)
let indexPath = IndexPath(row: 0, section: 0)
tableView.insertRows(at: [indexPath], with: .automatic)

View File

@ -273,7 +273,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
readerWindow.showWindow(self)
}
@IBAction func showPreferences(_ sender: AnyObject) {
@IBAction func showPreferences(_ sender: Any?) {
if preferencesWindowController == nil {
preferencesWindowController = windowControllerWithName("Preferences")
@ -282,28 +282,28 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
preferencesWindowController!.showWindow(self)
}
@IBAction func showMainWindow(_ sender: AnyObject) {
@IBAction func showMainWindow(_ sender: Any?) {
createAndShowMainWindow()
}
@IBAction func refreshAll(_ sender: AnyObject) {
@IBAction func refreshAll(_ sender: Any?) {
AccountManager.shared.refreshAll()
}
@IBAction func showAddFeedWindow(_ sender: AnyObject) {
@IBAction func showAddFeedWindow(_ sender: Any?) {
addFeed(nil)
}
@IBAction func showAddFolderWindow(_ sender: AnyObject) {
@IBAction func showAddFolderWindow(_ sender: Any?) {
createAndShowMainWindow()
showAddFolderSheetOnWindow(mainWindowController!.window!)
}
@IBAction func showFeedList(_ sender: AnyObject) {
@IBAction func showFeedList(_ sender: Any?) {
if feedListWindowController == nil {
feedListWindowController = windowControllerWithName("FeedList")
@ -353,7 +353,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
logWindowController!.showWindow(self)
}
@IBAction func importOPMLFromFile(_ sender: AnyObject) {
@IBAction func importOPMLFromFile(_ sender: Any?) {
let panel = NSOpenPanel()
panel.canDownloadUbiquitousContents = true
@ -378,11 +378,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
}
}
@IBAction func importOPMLFromURL(_ sender: AnyObject) {
@IBAction func importOPMLFromURL(_ sender: Any?) {
}
@IBAction func exportOPML(_ sender: AnyObject) {
@IBAction func exportOPML(_ sender: Any?) {
let panel = NSSavePanel()
panel.allowedFileTypes = ["opml"]
@ -409,7 +409,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
}
}
@IBAction func addAppNews(_ sender: AnyObject) {
@IBAction func addAppNews(_ sender: Any?) {
if AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) {
return
@ -417,17 +417,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
addFeed(appNewsURLString, "Evergreen News")
}
@IBAction func openWebsite(_ sender: AnyObject) {
@IBAction func openWebsite(_ sender: Any?) {
Browser.open("https://ranchero.com/evergreen/", inBackground: false)
}
@IBAction func openRepository(_ sender: AnyObject) {
@IBAction func openRepository(_ sender: Any?) {
Browser.open("https://github.com/brentsimmons/Evergreen", inBackground: false)
}
@IBAction func openBugTracker(_ sender: AnyObject) {
@IBAction func openBugTracker(_ sender: Any?) {
Browser.open("https://github.com/brentsimmons/Evergreen/issues", inBackground: false)
}
@ -437,7 +437,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
Browser.open("https://github.com/brentsimmons/Evergreen/tree/master/Technotes", inBackground: false)
}
@IBAction func showHelp(_ sender: AnyObject) {
@IBAction func showHelp(_ sender: Any?) {
Browser.open("https://ranchero.com/evergreen/help/1.0/", inBackground: false)
}

View File

@ -87,12 +87,12 @@ class AddFeedWindowController : NSWindowController {
// MARK: Actions
@IBAction func cancel(_ sender: AnyObject) {
@IBAction func cancel(_ sender: Any?) {
cancelSheet()
}
@IBAction func addFeed(_ sender: AnyObject) {
@IBAction func addFeed(_ sender: Any?) {
let urlString = urlTextField.stringValue
let normalizedURLString = (urlString as NSString).rs_normalizedURL()
@ -109,7 +109,7 @@ class AddFeedWindowController : NSWindowController {
delegate?.addFeedWindowController(self, userEnteredURL: url, userEnteredTitle: userEnteredTitle, container: selectedContainer()!)
}
@IBAction func localShowFeedList(_ sender: AnyObject) {
@IBAction func localShowFeedList(_ sender: Any?) {
NSApplication.shared.sendAction(NSSelectorFromString("showFeedList:"), to: nil, from: sender)
hostWindow.endSheet(window!, returnCode: NSApplication.ModalResponse.continue)

View File

@ -68,12 +68,12 @@ class AddFolderWindowController : NSWindowController {
// MARK: Actions
@IBAction func cancel(_ sender: AnyObject) {
@IBAction func cancel(_ sender: Any?) {
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.cancel)
}
@IBAction func addFolder(_ sender: AnyObject) {
@IBAction func addFolder(_ sender: Any?) {
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
}

View File

@ -186,12 +186,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
}
@IBAction func showAddFolderWindow(_ sender: Any) {
@IBAction func showAddFolderWindow(_ sender: Any?) {
appDelegate.showAddFolderSheetOnWindow(window!)
}
@IBAction func showAddFeedWindow(_ sender: Any) {
@IBAction func showAddFeedWindow(_ sender: Any?) {
appDelegate.showAddFeedSheetOnWindow(window!, urlString: nil, name: nil)
}

View File

@ -44,12 +44,12 @@ final class RenameWindowController: NSWindowController {
// MARK: Actions
@IBAction func cancel(_ sender: AnyObject) {
@IBAction func cancel(_ sender: Any?) {
window?.sheetParent?.endSheet(window!, returnCode: .cancel)
}
@IBAction func rename(_ sender: AnyObject) {
@IBAction func rename(_ sender: Any?) {
guard let representedObject = representedObject else {
return

View File

@ -165,6 +165,10 @@ import RSCore
outlineView.revealAndSelectRepresentedObject(SmartFeedsController.shared.starredFeed, treeController)
}
@IBAction func copy(_ sender: Any?) {
}
// MARK: Navigation
func canGoToNextUnread() -> Bool {

View File

@ -174,14 +174,14 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
// MARK: - Actions
@objc func openArticleInBrowser(_ sender: AnyObject) {
@objc func openArticleInBrowser(_ sender: Any?) {
if let link = oneSelectedArticle?.preferredLink {
Browser.open(link)
}
}
@IBAction func toggleStatusOfSelectedArticles(_ sender: AnyObject) {
@IBAction func toggleStatusOfSelectedArticles(_ sender: Any?) {
guard !selectedArticles.isEmpty else {
return

View File

@ -54,7 +54,7 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
// MARK: Actions
@objc func toolbarItemClicked(_ sender: AnyObject) {
@objc func toolbarItemClicked(_ sender: Any?) {
}