From a0184e52d572a70c9149e298487aa63af57d555c Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 27 Jun 2020 21:34:15 -0500 Subject: [PATCH] Older Xcode compatibility! --- .../OnboardingParentViewController.swift | 7 +++--- Clocker/Overall App/Themer.swift | 22 ++++++++++--------- Clocker/Panel/ParentPanelController.swift | 2 +- Clocker/Panel/UI/TimezoneDataSource.swift | 3 +-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Clocker/Onboarding/OnboardingParentViewController.swift b/Clocker/Onboarding/OnboardingParentViewController.swift index a2386dd..629b7f7 100644 --- a/Clocker/Onboarding/OnboardingParentViewController.swift +++ b/Clocker/Onboarding/OnboardingParentViewController.swift @@ -69,10 +69,9 @@ class OnboardingParentViewController: NSViewController { [negativeButton, backButton].forEach { $0?.isHidden = true } if #available(OSX 10.16, *) { - negativeButton.controlSize = .large - positiveButton.controlSize = .large - backButton.image = NSImage(systemSymbolName: "chevron.left.circle.fill", - accessibilityDescription: nil) +// negativeButton.controlSize = .large +// positiveButton.controlSize = .large + backButton.image = Themer.shared().symbolImage(for: "chevron.left.circle.fill", "back-button") } else { backButton.title = NSLocalizedString("Back", comment: "Button title for going back to the previous screen") diff --git a/Clocker/Overall App/Themer.swift b/Clocker/Overall App/Themer.swift index 1478d6f..d98197c 100644 --- a/Clocker/Overall App/Themer.swift +++ b/Clocker/Overall App/Themer.swift @@ -152,8 +152,7 @@ extension Themer { func shutdownImage() -> NSImage { if #available(macOS 10.16, *) { - return NSImage(systemSymbolName: "ellipsis.circle", - accessibilityDescription: nil)! + return symbolImage(for: "ellipsis.circle", nil) } if #available(macOS 10.14, *) { @@ -172,8 +171,7 @@ extension Themer { func preferenceImage() -> NSImage { if #available(macOS 10.16, *) { - return NSImage(systemSymbolName: "gear", - accessibilityDescription: nil)! + return symbolImage(for: "gear", nil) } if #available(macOS 10.14, *) { @@ -189,14 +187,13 @@ extension Themer { return themeIndex == .light - ? NSImage(named: NSImage.Name("Settings"))! - : NSImage(named: NSImage.Name("Settings-White"))! + ? NSImage(named: NSImage.Name("Settings"))! + : NSImage(named: NSImage.Name("Settings-White"))! } func pinImage() -> NSImage { if #available(macOS 10.16, *) { - return NSImage(systemSymbolName: "macwindow.on.rectangle", - accessibilityDescription: nil)! + return symbolImage(for: "macwindow.on.rectangle", nil) } if #available(macOS 10.14, *) { @@ -320,8 +317,7 @@ extension Themer { func sharingImage() -> NSImage { if #available(macOS 10.16, *) { - return NSImage(systemSymbolName: "square.and.arrow.up.on.square.fill", - accessibilityDescription: nil)! + return symbolImage(for: "square.and.arrow.up.on.square.fill", nil) } if #available(macOS 10.14, *) { @@ -448,4 +444,10 @@ extension Themer { NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) : NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0) } + + func symbolImage(for _: String, _: String?) -> NSImage { + // Dummy image for older xcodes + return NSImage(named: NSImage.Name("Calendar Tab Icon"))! +// return NSImage(systemSymbolName: name, accessibilityDescription: accessibilityDescription)! + } } diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index d455664..79bc020 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -168,7 +168,7 @@ class ParentPanelController: NSWindowController { showDebugVersionViewIfNeccesary() if #available(macOS 10.16, *) { - mainTableView.style = .fullWidth +// mainTableView.style = .fullWidth } } diff --git a/Clocker/Panel/UI/TimezoneDataSource.swift b/Clocker/Panel/UI/TimezoneDataSource.swift index 38d9f66..c602dba 100644 --- a/Clocker/Panel/UI/TimezoneDataSource.swift +++ b/Clocker/Panel/UI/TimezoneDataSource.swift @@ -135,8 +135,7 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate { }) if #available(OSX 10.16, *) { - swipeToDelete.image = NSImage(systemSymbolName: "trash.fill", - accessibilityDescription: nil) + swipeToDelete.image = Themer.shared().symbolImage(for: "trash.fill", "Trash Button") } else { swipeToDelete.image = NSImage(named: NSImage.Name("Trash")) }