Skip to content

Commit be5c0b1

Browse files
authored
Merge pull request #38 from dteoh/refactoring
Refactoring
2 parents f659e6f + 51fb959 commit be5c0b1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

devdocs-macos/DocumentationViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class DocumentationViewController: NSViewController {
9797

9898
// MARK:- Page search
9999

100-
@IBAction func searchPageContents(_ sender: NSSearchField) {
100+
@objc func searchPageContents(_ sender: NSSearchField) {
101101
let argsBytes = try! JSONSerialization.data(withJSONObject: ["term": sender.stringValue])
102102
let args = NSString(data: argsBytes, encoding: String.Encoding.utf8.rawValue)! as String
103103
webView.evaluateJavaScript("search( (\(args))[\"term\"] );")

devdocs-macos/DocumentationWindowController.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ class DocumentationWindowController: NSWindowController {
5353
name: .MenuFindAction,
5454
object: nil)
5555
}
56+
}
5657

57-
private func setupToolbar() {
58+
private extension DocumentationWindowController {
59+
func setupToolbar() {
5860
let toolbar = NSToolbar(identifier: "DocumentationWindowToolbar")
5961
toolbar.allowsUserCustomization = true
6062
toolbar.autosavesConfiguration = true
@@ -68,9 +70,13 @@ class DocumentationWindowController: NSWindowController {
6870
}
6971
}
7072

73+
@objc func openDocumentationInBrowser() {
74+
NSWorkspace.shared.open(documentation.url)
75+
}
76+
7177
// MARK:- NotificationCenter observers
7278

73-
@objc private func observeViewerState() {
79+
@objc func observeViewerState() {
7480
guard let dvc = documentationViewController else { return }
7581

7682
if dvc.viewerState != .ready {
@@ -81,22 +87,22 @@ class DocumentationWindowController: NSWindowController {
8187
dvc.useNativeScrollbars(true)
8288
}
8389

84-
@objc private func observeDocumentTitle() {
90+
@objc func observeDocumentTitle() {
8591
guard let dvc = documentationViewController else { return }
8692
self.window?.title = dvc.documentTitle ?? "DevDocs"
8793
}
8894

89-
@objc private func observeDocumentCategory() {
95+
@objc func observeDocumentCategory() {
9096
guard let dvc = documentationViewController else { return }
9197
self.window?.subtitle = dvc.documentCategory ?? ""
9298
}
9399

94-
@objc private func observeDocumentURL() {
100+
@objc func observeDocumentURL() {
95101
guard let dvc = documentationViewController else { return }
96102
self.documentation.url = dvc.documentURL
97103
}
98104

99-
@objc private func observeMenuFindAction() {
105+
@objc func observeMenuFindAction() {
100106
guard let window = self.window else { return }
101107
if !window.isKeyWindow {
102108
return
@@ -106,12 +112,6 @@ class DocumentationWindowController: NSWindowController {
106112
}
107113
}
108114

109-
private extension DocumentationWindowController {
110-
@objc func openDocumentationInBrowser() {
111-
NSWorkspace.shared.open(documentation.url)
112-
}
113-
}
114-
115115
// MARK:- DocumentationViewDelegate
116116
extension DocumentationWindowController: DocumentationViewDelegate {
117117
func selectFileToOpen(_ parameters: OpenPanelParameters, completionHandler: @escaping ([URL]?) -> Void) {

0 commit comments

Comments
 (0)