fix: adds missing return statements

so the project builds without any compile errors on macOS high sierra (10.13.x)
This commit is contained in:
Mariusz Bieniek authored and lwouis committed 2019-10-28 16:48:46 +09:00
1 parent d9a23c21bd
commit 4b517ff5b9
5 files changed
+8 -8

No files matched your search

+3 -3
View File
@@ -99,11 +99,11 @@ class Preferences {
} }
private static func preferencesVersion(_ url: URL) throws -> Int { private static func preferencesVersion(_ url: URL) throws -> Int {
try Int(loadFromDisk(url)["version"] ?? "0").orThrow() return try Int(loadFromDisk(url)["version"] ?? "0").orThrow()
} }
private static func loadFromDisk(_ url: URL) throws -> [String: String] { private static func loadFromDisk(_ url: URL) throws -> [String: String] {
try JSONDecoder().decode([String: String].self, from: Data(contentsOf: url)) return try JSONDecoder().decode([String: String].self, from: Data(contentsOf: url))
} }
private static func handleNoFileOrOldFile(_ userFile: URL) throws { private static func handleNoFileOrOldFile(_ userFile: URL) throws {
@@ -132,7 +132,7 @@ class Preferences {
} }
private static func fileFromPreferencesFolder(_ fileName: String) -> URL { private static func fileFromPreferencesFolder(_ fileName: String) -> URL {
FileManager.default return FileManager.default
.urls(for: .libraryDirectory, in: .userDomainMask) .urls(for: .libraryDirectory, in: .userDomainMask)
.first! .first!
.appendingPathComponent("Preferences", isDirectory: true) .appendingPathComponent("Preferences", isDirectory: true)
+1 -1
View File
@@ -17,7 +17,7 @@ class OpenWindow {
} }
func computeIcon() -> NSImage? { func computeIcon() -> NSImage? {
NSRunningApplication(processIdentifier: ownerPid!)?.icon return NSRunningApplication(processIdentifier: ownerPid!)?.icon
} }
func computeThumbnail() -> NSImage { func computeThumbnail() -> NSImage {
+2 -2
View File
@@ -91,7 +91,7 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate {
} }
func cellWithStep(_ step: Int) -> Int { func cellWithStep(_ step: Int) -> Int {
selectedOpenWindow + step < 0 ? openWindows.count - 1 : (selectedOpenWindow + step) % openWindows.count return selectedOpenWindow + step < 0 ? openWindows.count - 1 : (selectedOpenWindow + step) % openWindows.count
} }
func cycleSelection(_ step: Int) { func cycleSelection(_ step: Int) {
@@ -130,6 +130,6 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate {
} }
func currentlySelectedWindow() -> OpenWindow? { func currentlySelectedWindow() -> OpenWindow? {
openWindows.count > selectedOpenWindow ? openWindows[selectedOpenWindow] : nil return openWindows.count > selectedOpenWindow ? openWindows[selectedOpenWindow] : nil
} }
} }
+1 -1
View File
@@ -25,7 +25,7 @@ class PreferencesPanel: NSPanel, NSTextViewDelegate {
} }
private func makeLabelsAndInputs() -> [[NSView]] { private func makeLabelsAndInputs() -> [[NSView]] {
[ return [
makeLabelWithDropdown(\PreferencesPanel.theme, "Main window theme", "theme", Preferences.themeMacro.labels), makeLabelWithDropdown(\PreferencesPanel.theme, "Main window theme", "theme", Preferences.themeMacro.labels),
makeLabelWithDropdown(\PreferencesPanel.metaKey, "Meta key to activate the app", "metaKey", Preferences.metaKeyMacro.labels), makeLabelWithDropdown(\PreferencesPanel.metaKey, "Meta key to activate the app", "metaKey", Preferences.metaKeyMacro.labels),
makeLabelWithInput(\PreferencesPanel.tabKeyCode, "Tab key (NSEvent.keyCode)", "tabKeyCode"), makeLabelWithInput(\PreferencesPanel.tabKeyCode, "Tab key (NSEvent.keyCode)", "tabKeyCode"),
+1 -1
View File
@@ -58,7 +58,7 @@ class ThumbnailsPanel: NSPanel, NSCollectionViewDataSource, NSCollectionViewDele
func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int { func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
// debugPrint("collectionView: count items", openWindows.count) // debugPrint("collectionView: count items", openWindows.count)
application!.openWindows.count return application!.openWindows.count
} }
func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {