From 4b517ff5b9c0f2a27b0e07e6c28ca9bb3bf92b8c Mon Sep 17 00:00:00 2001 From: Mariusz Bieniek Date: Sat, 26 Oct 2019 20:17:59 +0200 Subject: [PATCH] fix: adds missing return statements so the project builds without any compile errors on macOS high sierra (10.13.x) --- alt-tab-macos/logic/Preferences.swift | 6 +++--- alt-tab-macos/logic/WindowManager.swift | 2 +- alt-tab-macos/ui/Application.swift | 4 ++-- alt-tab-macos/ui/PreferencesPanel.swift | 2 +- alt-tab-macos/ui/ThumbnailsPanel.swift | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/alt-tab-macos/logic/Preferences.swift b/alt-tab-macos/logic/Preferences.swift index 58b1c6b9..0c6ad350 100644 --- a/alt-tab-macos/logic/Preferences.swift +++ b/alt-tab-macos/logic/Preferences.swift @@ -99,11 +99,11 @@ class Preferences { } 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] { - 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 { @@ -132,7 +132,7 @@ class Preferences { } private static func fileFromPreferencesFolder(_ fileName: String) -> URL { - FileManager.default + return FileManager.default .urls(for: .libraryDirectory, in: .userDomainMask) .first! .appendingPathComponent("Preferences", isDirectory: true) diff --git a/alt-tab-macos/logic/WindowManager.swift b/alt-tab-macos/logic/WindowManager.swift index b7cb2a9f..7ebc7caa 100644 --- a/alt-tab-macos/logic/WindowManager.swift +++ b/alt-tab-macos/logic/WindowManager.swift @@ -17,7 +17,7 @@ class OpenWindow { } func computeIcon() -> NSImage? { - NSRunningApplication(processIdentifier: ownerPid!)?.icon + return NSRunningApplication(processIdentifier: ownerPid!)?.icon } func computeThumbnail() -> NSImage { diff --git a/alt-tab-macos/ui/Application.swift b/alt-tab-macos/ui/Application.swift index a45d70b1..1eb09c8e 100644 --- a/alt-tab-macos/ui/Application.swift +++ b/alt-tab-macos/ui/Application.swift @@ -91,7 +91,7 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate { } 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) { @@ -130,6 +130,6 @@ class Application: NSApplication, NSApplicationDelegate, NSWindowDelegate { } func currentlySelectedWindow() -> OpenWindow? { - openWindows.count > selectedOpenWindow ? openWindows[selectedOpenWindow] : nil + return openWindows.count > selectedOpenWindow ? openWindows[selectedOpenWindow] : nil } } diff --git a/alt-tab-macos/ui/PreferencesPanel.swift b/alt-tab-macos/ui/PreferencesPanel.swift index 8a977f58..44732f23 100644 --- a/alt-tab-macos/ui/PreferencesPanel.swift +++ b/alt-tab-macos/ui/PreferencesPanel.swift @@ -25,7 +25,7 @@ class PreferencesPanel: NSPanel, NSTextViewDelegate { } private func makeLabelsAndInputs() -> [[NSView]] { - [ + return [ makeLabelWithDropdown(\PreferencesPanel.theme, "Main window theme", "theme", Preferences.themeMacro.labels), makeLabelWithDropdown(\PreferencesPanel.metaKey, "Meta key to activate the app", "metaKey", Preferences.metaKeyMacro.labels), makeLabelWithInput(\PreferencesPanel.tabKeyCode, "Tab key (NSEvent.keyCode)", "tabKeyCode"), diff --git a/alt-tab-macos/ui/ThumbnailsPanel.swift b/alt-tab-macos/ui/ThumbnailsPanel.swift index 0e6cdaa1..1bcd1f7b 100644 --- a/alt-tab-macos/ui/ThumbnailsPanel.swift +++ b/alt-tab-macos/ui/ThumbnailsPanel.swift @@ -58,7 +58,7 @@ class ThumbnailsPanel: NSPanel, NSCollectionViewDataSource, NSCollectionViewDele func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int { // debugPrint("collectionView: count items", openWindows.count) - application!.openWindows.count + return application!.openWindows.count } func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {