diff --git a/Mist/AppCommands.swift b/Mist/AppCommands.swift index 94752a3..b83add7 100644 --- a/Mist/AppCommands.swift +++ b/Mist/AppCommands.swift @@ -51,7 +51,6 @@ struct AppCommands: Commands { } private func help() { - guard let url: URL = URL(string: .repositoryURL) else { return } diff --git a/Mist/AppDelegate.swift b/Mist/AppDelegate.swift index 038c40a..f17aabb 100644 --- a/Mist/AppDelegate.swift +++ b/Mist/AppDelegate.swift @@ -9,7 +9,6 @@ import AppKit import UserNotifications class AppDelegate: NSObject, NSApplicationDelegate { - // swiftlint:disable:next weak_delegate private let userNotificationCenterDelegate: UserNotificationCenterDelegate = UserNotificationCenterDelegate() @@ -28,7 +27,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func sendUpdateNotification(title: String, body: String, success: Bool, url: URL?) { - let notificationCenter: UNUserNotificationCenter = .current() notificationCenter.getNotificationSettings { settings in diff --git a/Mist/Extensions/Array+Extension.swift b/Mist/Extensions/Array+Extension.swift index ea6b82f..6246b2a 100644 --- a/Mist/Extensions/Array+Extension.swift +++ b/Mist/Extensions/Array+Extension.swift @@ -6,7 +6,6 @@ // extension Array where Element == UInt8 { - func uInt8(at offset: Int) -> UInt8 { self[offset] } diff --git a/Mist/Extensions/AuthorizationError+Extension.swift b/Mist/Extensions/AuthorizationError+Extension.swift index 58f30ad..5405aa2 100644 --- a/Mist/Extensions/AuthorizationError+Extension.swift +++ b/Mist/Extensions/AuthorizationError+Extension.swift @@ -8,7 +8,6 @@ import Authorized extension AuthorizationError: Equatable { - public static func == (lhs: AuthorizationError, rhs: AuthorizationError) -> Bool { lhs.localizedDescription == rhs.localizedDescription } diff --git a/Mist/Extensions/ButtonStyle+Extension.swift b/Mist/Extensions/ButtonStyle+Extension.swift index ca33ce5..069f2dd 100644 --- a/Mist/Extensions/ButtonStyle+Extension.swift +++ b/Mist/Extensions/ButtonStyle+Extension.swift @@ -8,7 +8,6 @@ import SwiftUI extension ButtonStyle where Self == MistActionButtonStyle { - static var mistAction: Self { .init() } diff --git a/Mist/Extensions/Dictionary+Extension.swift b/Mist/Extensions/Dictionary+Extension.swift index de0def5..c0cb1af 100644 --- a/Mist/Extensions/Dictionary+Extension.swift +++ b/Mist/Extensions/Dictionary+Extension.swift @@ -6,9 +6,7 @@ // extension Dictionary where Key == String { - func firmwareCSVString() -> String { - guard let signed: Bool = self["signed"] as? Bool, let name: String = self["name"] as? String, let version: String = self["version"] as? String, @@ -24,7 +22,6 @@ extension Dictionary where Key == String { } func installerCSVString() -> String { - guard let identifier: String = self["identifier"] as? String, let name: String = self["name"] as? String, let version: String = self["version"] as? String, diff --git a/Mist/Extensions/Double+Extension.swift b/Mist/Extensions/Double+Extension.swift index 4cb8922..eb099eb 100644 --- a/Mist/Extensions/Double+Extension.swift +++ b/Mist/Extensions/Double+Extension.swift @@ -8,7 +8,6 @@ import Foundation extension Double { - /// kilobytes constant static let kilobyte: Double = 1_000 /// megabytes constant @@ -17,7 +16,6 @@ extension Double { static let gigabyte: Double = .megabyte * 1_000 func bytesString() -> String { - if self < .kilobyte { return "\(Int(self)) bytes" } else if self < .megabyte { diff --git a/Mist/Extensions/FileManager+Extension.swift b/Mist/Extensions/FileManager+Extension.swift index c4b9ac3..139c0c5 100644 --- a/Mist/Extensions/FileManager+Extension.swift +++ b/Mist/Extensions/FileManager+Extension.swift @@ -8,9 +8,7 @@ import Foundation extension FileManager { - func sizeOfDirectory(at url: URL) throws -> UInt64 { - var enumeratorError: Error? let urlResourceKeys: Set = [ @@ -29,7 +27,6 @@ extension FileManager { var size: UInt64 = 0 for item in enumerator { - if enumeratorError != nil { break } diff --git a/Mist/Extensions/Scene+Extension.swift b/Mist/Extensions/Scene+Extension.swift index 333068c..81d4472 100644 --- a/Mist/Extensions/Scene+Extension.swift +++ b/Mist/Extensions/Scene+Extension.swift @@ -8,7 +8,6 @@ import SwiftUI extension Scene { - func fixedWindow() -> some Scene { if #available(macOS 13.0, *) { return self.windowResizability(.contentSize) diff --git a/Mist/Extensions/Sequence+Extension.swift b/Mist/Extensions/Sequence+Extension.swift index 1eba7a5..3209ed3 100644 --- a/Mist/Extensions/Sequence+Extension.swift +++ b/Mist/Extensions/Sequence+Extension.swift @@ -9,7 +9,6 @@ import Foundation import Yams extension Sequence where Iterator.Element == [String: Any] { - func firmwaresCSVString() -> String { "Signed,Name,Version,Build,Size,Date,Compatible\n" + self.map { $0.firmwareCSVString() }.joined() } diff --git a/Mist/Extensions/String+Extension.swift b/Mist/Extensions/String+Extension.swift index 0c84e0c..b6e30ba 100644 --- a/Mist/Extensions/String+Extension.swift +++ b/Mist/Extensions/String+Extension.swift @@ -8,7 +8,6 @@ import Foundation extension String { - static let appName: String = "mist" static let appIdentifier: String = "com.ninxsoft.\(appName)" static let helperIdentifier: String = "\(appIdentifier).helper" diff --git a/Mist/Extensions/UInt32+Extension.swift b/Mist/Extensions/UInt32+Extension.swift index 5cdab7a..129b2f2 100644 --- a/Mist/Extensions/UInt32+Extension.swift +++ b/Mist/Extensions/UInt32+Extension.swift @@ -8,7 +8,6 @@ import Foundation extension UInt32 { - func hexString() -> String { String(format: "0x%08X", self) } diff --git a/Mist/Extensions/UInt64+Extension.swift b/Mist/Extensions/UInt64+Extension.swift index 6916b77..ff55053 100644 --- a/Mist/Extensions/UInt64+Extension.swift +++ b/Mist/Extensions/UInt64+Extension.swift @@ -8,7 +8,6 @@ import Foundation extension UInt64 { - /// kilobytes constant static let kilobyte: UInt64 = 1_000 /// megabytes constant @@ -17,7 +16,6 @@ extension UInt64 { static let gigabyte: UInt64 = .megabyte * 1_000 func bytesString() -> String { - if self < .kilobyte { return "\(self) bytes" } else if self < .megabyte { diff --git a/Mist/Extensions/UInt8+Extension.swift b/Mist/Extensions/UInt8+Extension.swift index 75e7a19..850b478 100644 --- a/Mist/Extensions/UInt8+Extension.swift +++ b/Mist/Extensions/UInt8+Extension.swift @@ -8,7 +8,6 @@ import Foundation extension UInt8 { - func hexString() -> String { String(format: "0x%02X", self) } diff --git a/Mist/Extensions/UNNotificationAction+Extension.swift b/Mist/Extensions/UNNotificationAction+Extension.swift index f987f71..42d632e 100644 --- a/Mist/Extensions/UNNotificationAction+Extension.swift +++ b/Mist/Extensions/UNNotificationAction+Extension.swift @@ -8,7 +8,6 @@ import UserNotifications extension UNNotificationAction { - struct Identifier { /// Show Identifier static let show: String = "Show" diff --git a/Mist/Extensions/UNNotificationCategory+Extension.swift b/Mist/Extensions/UNNotificationCategory+Extension.swift index 7d5e5d5..1f484a6 100644 --- a/Mist/Extensions/UNNotificationCategory+Extension.swift +++ b/Mist/Extensions/UNNotificationCategory+Extension.swift @@ -8,7 +8,6 @@ import UserNotifications extension UNNotificationCategory { - struct Identifier { /// Success Identifier static let success: String = "Success" diff --git a/Mist/Extensions/URL+Extension.swift b/Mist/Extensions/URL+Extension.swift index 9faefc3..d77b0d8 100644 --- a/Mist/Extensions/URL+Extension.swift +++ b/Mist/Extensions/URL+Extension.swift @@ -9,9 +9,7 @@ import CryptoKit import Foundation extension URL { - func fileSize() throws -> UInt64 { - let urlResourceKeys: Set = [ .isRegularFileKey, .fileAllocatedSizeKey, @@ -29,7 +27,6 @@ extension URL { } func shasum() -> String? { - let length: Int = 1_024 * 1_024 * 50 // 50 MB do { diff --git a/Mist/Helpers/Codesigner.swift b/Mist/Helpers/Codesigner.swift index f6b3227..02cefb1 100644 --- a/Mist/Helpers/Codesigner.swift +++ b/Mist/Helpers/Codesigner.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to codesign a file (ie. Disk Image). struct Codesigner { - /// Sign a file with the provided signing identity. /// /// - Parameters: diff --git a/Mist/Helpers/DirectoryCreator.swift b/Mist/Helpers/DirectoryCreator.swift index 8edd671..c10fc04 100644 --- a/Mist/Helpers/DirectoryCreator.swift +++ b/Mist/Helpers/DirectoryCreator.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to create directories. struct DirectoryCreator { - /// Create a directory at the provided URL. /// /// - Parameters: diff --git a/Mist/Helpers/DirectoryRemover.swift b/Mist/Helpers/DirectoryRemover.swift index ca9af73..da8df2e 100644 --- a/Mist/Helpers/DirectoryRemover.swift +++ b/Mist/Helpers/DirectoryRemover.swift @@ -10,7 +10,6 @@ import SecureXPC /// Helper struct to remove directories struct DirectoryRemover { - /// Remove directory at the provided URL. /// /// - Parameters: @@ -18,7 +17,6 @@ struct DirectoryRemover { /// /// - Throws: An `Error` if the command failed to execute. static func remove(_ url: URL) async throws { - guard FileManager.default.fileExists(atPath: url.path) else { return } diff --git a/Mist/Helpers/DiskImageCreator.swift b/Mist/Helpers/DiskImageCreator.swift index d8d2fba..101897a 100644 --- a/Mist/Helpers/DiskImageCreator.swift +++ b/Mist/Helpers/DiskImageCreator.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to create disk images. struct DiskImageCreator { - /// Create an empty Disk Image of fixed size. /// /// - Parameters: @@ -18,7 +17,6 @@ struct DiskImageCreator { /// /// - Throws: An `MistError` if the command failed to execute. static func create(_ url: URL, size: Double) async throws { - let arguments: [String] = [ "hdiutil", "create", "-fs", "JHFS+", @@ -38,7 +36,6 @@ struct DiskImageCreator { /// /// - Throws: An `MistError` if the command failed to execute. static func create(_ url: URL, from source: URL) async throws { - let arguments: [String] = [ "hdiutil", "create", "-fs", "HFS+", @@ -57,7 +54,6 @@ struct DiskImageCreator { /// /// - Throws: An `MistError` if the command failed to execute. private static func create(_ url: URL, with arguments: [String]) async throws { - try await DirectoryRemover.remove(url) let response: HelperToolCommandResponse = try ShellExecutor.shared.execute(arguments) diff --git a/Mist/Helpers/DiskImageMounter.swift b/Mist/Helpers/DiskImageMounter.swift index d196c4a..fc0627b 100644 --- a/Mist/Helpers/DiskImageMounter.swift +++ b/Mist/Helpers/DiskImageMounter.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to mount Disk Images. struct DiskImageMounter { - /// Mount a Disk Image at the provided mount point. /// /// - Parameters: @@ -18,7 +17,6 @@ struct DiskImageMounter { /// /// - Throws: A `MistError` if the command failed to execute. static func mount(_ url: URL, mountPoint: URL) async throws { - do { try await DiskImageUnmounter.unmount(mountPoint) } catch { diff --git a/Mist/Helpers/DiskImageUnmounter.swift b/Mist/Helpers/DiskImageUnmounter.swift index e93982c..4533773 100644 --- a/Mist/Helpers/DiskImageUnmounter.swift +++ b/Mist/Helpers/DiskImageUnmounter.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to unmount Disk Images. struct DiskImageUnmounter { - /// Unmount a Disk Image at the provided mount point. /// /// - Parameters: diff --git a/Mist/Helpers/DownloadManager.swift b/Mist/Helpers/DownloadManager.swift index 957b25d..4272adc 100644 --- a/Mist/Helpers/DownloadManager.swift +++ b/Mist/Helpers/DownloadManager.swift @@ -8,7 +8,6 @@ import Foundation class DownloadManager: NSObject, ObservableObject { - static let shared: DownloadManager = DownloadManager() private var task: URLSessionDownloadTask? private var progress: Progress = Progress() @@ -18,7 +17,6 @@ class DownloadManager: NSObject, ObservableObject { // swiftlint:disable:next cyclomatic_complexity function_body_length func download(_ url: URL, to destination: URL, retries retriesMaximum: Int, delay retryDelay: Int) async throws { - guard !FileManager.default.fileExists(atPath: destination.path) else { return } @@ -32,7 +30,6 @@ class DownloadManager: NSObject, ObservableObject { let completionHandler: (URL?, URLResponse?, Error?) -> Void = { url, _, error in if let error: URLError = error as? URLError { - guard error.code != .cancelled else { mistError = .userCancelled completed = true @@ -74,13 +71,11 @@ class DownloadManager: NSObject, ObservableObject { } while !completed { - guard retries < retriesMaximum else { throw MistError.maximumRetriesReached } if let error: URLError = urlError { - guard let data: Data = error.downloadTaskResumeData else { throw MistError.invalidDownloadResumeData } diff --git a/Mist/Helpers/FileAttributesUpdater.swift b/Mist/Helpers/FileAttributesUpdater.swift index 3ee1e29..df5ffe9 100644 --- a/Mist/Helpers/FileAttributesUpdater.swift +++ b/Mist/Helpers/FileAttributesUpdater.swift @@ -10,7 +10,6 @@ import SecureXPC /// Helper struct to update file / directory attributes struct FileAttributesUpdater { - /// Update file / directory attributes at the provided URL. /// /// - Parameters: @@ -19,7 +18,6 @@ struct FileAttributesUpdater { /// /// - Throws: An `Error` if the command failed to execute. static func update(url: URL, ownerAccountName: String) async throws { - guard FileManager.default.fileExists(atPath: url.path) else { return } diff --git a/Mist/Helpers/FileCopier.swift b/Mist/Helpers/FileCopier.swift index 4fe47df..fc3eca8 100644 --- a/Mist/Helpers/FileCopier.swift +++ b/Mist/Helpers/FileCopier.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to copy files. struct FileCopier { - /// Copy a file from one location to another. /// /// - Parameters: diff --git a/Mist/Helpers/FileMover.swift b/Mist/Helpers/FileMover.swift index 64b2980..a83464c 100644 --- a/Mist/Helpers/FileMover.swift +++ b/Mist/Helpers/FileMover.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to move files. struct FileMover { - /// Move a file from one location to another. /// /// - Parameters: diff --git a/Mist/Helpers/ISOConverter.swift b/Mist/Helpers/ISOConverter.swift index 736ef05..dc527bd 100644 --- a/Mist/Helpers/ISOConverter.swift +++ b/Mist/Helpers/ISOConverter.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to convert Disk Images to ISOs. struct ISOConverter { - /// Convert a Disk Image to an ISO. /// /// - Parameters: diff --git a/Mist/Helpers/InstallMediaCreator.swift b/Mist/Helpers/InstallMediaCreator.swift index 203700e..3e9281d 100644 --- a/Mist/Helpers/InstallMediaCreator.swift +++ b/Mist/Helpers/InstallMediaCreator.swift @@ -10,7 +10,6 @@ import SecureXPC /// Helper struct to execute the `createinstallmedia` command found in macOS Install app bundles. struct InstallMediaCreator { - /// Create the macOS Install Media at the specified mount point. /// /// - Parameters: diff --git a/Mist/Helpers/InstallerCreator.swift b/Mist/Helpers/InstallerCreator.swift index f91e11c..1bc8a0d 100644 --- a/Mist/Helpers/InstallerCreator.swift +++ b/Mist/Helpers/InstallerCreator.swift @@ -10,7 +10,6 @@ import SecureXPC /// Helper Struct used to create macOS Installers. struct InstallerCreator { - /// Creates a recently downloaded macOS Installer. /// /// - Parameters: @@ -20,11 +19,9 @@ struct InstallerCreator { /// /// - Throws: A `MistError` if the downloaded macOS Installer fails to generate. static func create(_ installer: Installer, mountPoint: URL, cacheDirectory: String) async throws { - let packageURL: URL if installer.sierraOrOlder { - guard let package: Package = installer.packages.first else { throw MistError.invalidData } diff --git a/Mist/Helpers/PackageCreator.swift b/Mist/Helpers/PackageCreator.swift index 432a7d3..4a882a3 100644 --- a/Mist/Helpers/PackageCreator.swift +++ b/Mist/Helpers/PackageCreator.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to create macOS Installer Packages. struct PackageCreator { - /// Create a macOS Installer Package based off the passed in `Installer` struct. /// /// - Parameters: @@ -20,7 +19,6 @@ struct PackageCreator { /// /// - Throws: An `Error` if the command failed to execute. static func create(_ url: URL, from installer: Installer, identifier: String, identity: String? = nil) async throws { - var arguments: [String] = [ "pkgbuild", "--identifier", identifier, @@ -45,7 +43,6 @@ struct PackageCreator { /// /// - Throws: An `MistError` if the command failed to execute. private static func create(_ url: URL, with arguments: [String]) async throws { - try await DirectoryRemover.remove(url) let response: HelperToolCommandResponse = try ShellExecutor.shared.execute(arguments) diff --git a/Mist/Helpers/PrivilegedHelperTool.swift b/Mist/Helpers/PrivilegedHelperTool.swift index 6666211..1519ccc 100644 --- a/Mist/Helpers/PrivilegedHelperTool.swift +++ b/Mist/Helpers/PrivilegedHelperTool.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to perform lookups on the Privilged Helper Tool executable. struct PrivilegedHelperTool { - /// The URL of the Privileged Helper Tool within the Mist app bundle. static let availableURL: URL = URL(fileURLWithPath: "\(Bundle.main.bundlePath)/Contents/Library/LaunchServices/\(String.helperIdentifier)") /// The URL of the Privileged Helper Tool within /Library/PrivilegedHelperTools. @@ -19,7 +18,6 @@ struct PrivilegedHelperTool { /// /// - Returns: `true` if the Privileged Helper Tool is installed, otherwise `false`. static func isInstalled() -> Bool { - do { // launchctl service is loaded let arguments: [String] = ["launchctl", "print", "system/\(String.helperIdentifier)"] diff --git a/Mist/Helpers/ProcessKiller.swift b/Mist/Helpers/ProcessKiller.swift index 895c54c..8e04269 100644 --- a/Mist/Helpers/ProcessKiller.swift +++ b/Mist/Helpers/ProcessKiller.swift @@ -9,7 +9,6 @@ import SecureXPC /// Helper struct to kill the child process of the Privileted Helper Tool. struct ProcessKiller { - /// Attempts to kill the child process of the Privileged Helper Tool. /// /// - Throws: A `MistError` if the process fails to be killed. diff --git a/Mist/Helpers/PropertyListUpdater.swift b/Mist/Helpers/PropertyListUpdater.swift index 37563ab..1db41b5 100644 --- a/Mist/Helpers/PropertyListUpdater.swift +++ b/Mist/Helpers/PropertyListUpdater.swift @@ -9,7 +9,6 @@ import Foundation /// Helper struct to update a Property List key-pair value. struct PropertyListUpdater { - /// Update a key-pair value in a Property List. /// /// - Parameters: @@ -19,7 +18,6 @@ struct PropertyListUpdater { /// /// - Throws: An `Error` if the command failed to execute. static func update(_ url: URL, key: String, value: AnyHashable) throws { - let input: String = try String(contentsOf: url, encoding: .utf8) guard var data: Data = input.data(using: .utf8) else { diff --git a/Mist/Helpers/TaskManager.swift b/Mist/Helpers/TaskManager.swift index 2d2ad9b..c4ca7bb 100644 --- a/Mist/Helpers/TaskManager.swift +++ b/Mist/Helpers/TaskManager.swift @@ -11,13 +11,11 @@ import System // swiftlint:disable file_length // swiftlint:disable:next type_body_length class TaskManager: ObservableObject { - static let shared: TaskManager = TaskManager() @Published var taskGroups: [(section: MistTaskSection, tasks: [MistTask])] var task: Task = Task { } var currentState: MistTaskState { - let states: Set = Set(taskGroups.flatMap { $0.tasks }.map { $0.state }) if states.contains(.inProgress) { @@ -40,7 +38,6 @@ class TaskManager: ObservableObject { } static func taskGroups(for firmware: Firmware, destination destinationURL: URL?, retries: Int, delay retryDelay: Int) throws -> [(section: MistTaskSection, tasks: [MistTask])] { - let temporaryDirectoryURL: URL = URL(fileURLWithPath: .temporaryDirectory) guard let destinationURL: URL = destinationURL else { @@ -265,7 +262,6 @@ class TaskManager: ObservableObject { } private static func downloadTasks(for installer: Installer, cacheDirectory cacheDirectoryURL: URL, retries: Int, delay retryDelay: Int) throws -> [MistTask] { - var tasks: [MistTask] = [] if !FileManager.default.fileExists(atPath: cacheDirectoryURL.path) { @@ -295,7 +291,6 @@ class TaskManager: ObservableObject { } for package in installer.allDownloads { - guard let packageURL: URL = URL(string: package.url) else { throw MistError.invalidURL(package.url) } @@ -316,7 +311,6 @@ class TaskManager: ObservableObject { } private static func installTasks(for installer: Installer, temporaryDirectory temporaryDirectoryURL: URL, mountPoint mountPointURL: URL, cacheDirectory: String) -> [MistTask] { - let imageURL: URL = temporaryDirectoryURL.appendingPathComponent("\(installer.id) Temp.dmg") var tasks: [MistTask] = [ MistTask(type: .configure, description: "temporary directory") { @@ -371,7 +365,6 @@ class TaskManager: ObservableObject { } private static func applicationTasks(for installer: Installer, filename: String, destination destinationURL: URL) -> [MistTask] { - let applicationURL: URL = destinationURL.appendingPathComponent(filename.stringWithSubstitutions(name: installer.name, version: installer.version, build: installer.build)) return [ @@ -390,7 +383,6 @@ class TaskManager: ObservableObject { destination destinationURL: URL, temporaryDirectory temporaryDirectoryURL: URL ) -> [MistTask] { - let imageDirectoryURL: URL = temporaryDirectoryURL.appendingPathComponent(installer.id) let applicationURL: URL = imageDirectoryURL.appendingPathComponent(installer.temporaryInstallerURL.lastPathComponent) let temporaryImageURL: URL = temporaryDirectoryURL.appendingPathComponent("\(installer.id).dmg") @@ -427,7 +419,6 @@ class TaskManager: ObservableObject { } private static func isoTasks(for installer: Installer, filename: String, destination destinationURL: URL, temporaryDirectory temporaryDirectoryURL: URL) -> [MistTask] { - let temporaryImageURL: URL = temporaryDirectoryURL.appendingPathComponent("\(installer.id).dmg") let createInstallMediaURL: URL = installer.temporaryInstallerURL.appendingPathComponent("Contents/Resources/createinstallmedia") let temporaryCDRURL: URL = temporaryDirectoryURL.appendingPathComponent("\(installer.id).cdr") @@ -442,7 +433,6 @@ class TaskManager: ObservableObject { try await DiskImageMounter.mount(temporaryImageURL, mountPoint: installer.temporaryISOMountPointURL) }, MistTask(type: .create, description: "macOS Installer in temporary Disk Image") { - // Workaround to make macOS Sierra 10.12 createinstallmedia work if installer.version.hasPrefix("10.12") { let infoPlistURL: URL = installer.temporaryInstallerURL.appendingPathComponent("Contents/Info.plist") @@ -497,7 +487,6 @@ class TaskManager: ObservableObject { temporaryDirectory temporaryDirectoryURL: URL, cacheDirectory cacheDirectoryURL: URL ) -> [MistTask] { - let packageURL: URL = destinationURL.appendingPathComponent(filename.stringWithSubstitutions(name: installer.name, version: installer.version, build: installer.build)) var tasks: [MistTask] = [] @@ -532,7 +521,6 @@ class TaskManager: ObservableObject { let mountPointURL: URL = URL(fileURLWithPath: volume.path) let tasks: [MistTask] = [ MistTask(type: .create, description: "Bootable Installer") { - // Workaround to make macOS Sierra 10.12 createinstallmedia work if installer.version.hasPrefix("10.12") { let infoPlistURL: URL = installer.temporaryInstallerURL.appendingPathComponent("Contents/Info.plist") @@ -547,7 +535,6 @@ class TaskManager: ObservableObject { } private static func cleanupTasks(mountPoint mountPointURL: URL, temporaryDirectory temporaryDirectoryURL: URL, cacheDownloads: Bool, cacheDirectory cacheDirectoryURL: URL) -> [MistTask] { - var tasks: [MistTask] = [ MistTask(type: .unmount, description: "Disk Image") { try await DiskImageUnmounter.unmount(mountPointURL) diff --git a/Mist/Helpers/Validator.swift b/Mist/Helpers/Validator.swift index 477bf3f..fd88d04 100644 --- a/Mist/Helpers/Validator.swift +++ b/Mist/Helpers/Validator.swift @@ -10,7 +10,6 @@ import Foundation /// Helper struct used to validate Firmware and Installer checksums. struct Validator { - /// Validates a Firmware's checksum. /// /// - Parameters: @@ -19,7 +18,6 @@ struct Validator { /// /// - Throws: A `MistError` if the validation fails. static func validate(_ firmware: Firmware, at destination: URL) async throws { - guard let shasum: String = destination.shasum() else { throw MistError.invalidData } @@ -37,7 +35,6 @@ struct Validator { /// /// - Throws: A `MistError` if the validation fails. static func validate(_ package: Package, at destination: URL) async throws { - guard !package.url.hasSuffix("English.dist") else { return } diff --git a/Mist/MistApp.swift b/Mist/MistApp.swift index 68c1b40..7fae008 100644 --- a/Mist/MistApp.swift +++ b/Mist/MistApp.swift @@ -33,9 +33,7 @@ struct MistApp: App { } func hideZoomButton() { - for window in NSApplication.shared.windows { - guard let button: NSButton = window.standardWindowButton(NSWindow.ButtonType.zoomButton) else { continue } diff --git a/Mist/Model/Catalog.swift b/Mist/Model/Catalog.swift index 9bb50aa..95c4a37 100644 --- a/Mist/Model/Catalog.swift +++ b/Mist/Model/Catalog.swift @@ -8,7 +8,6 @@ import Foundation struct Catalog: Identifiable, Decodable, Equatable { - enum CodingKeys: String, CodingKey { // swiftlint:disable:next redundant_string_enum_value case type = "type" diff --git a/Mist/Model/CatalogType.swift b/Mist/Model/CatalogType.swift index 16fbd22..0e52021 100644 --- a/Mist/Model/CatalogType.swift +++ b/Mist/Model/CatalogType.swift @@ -38,7 +38,6 @@ enum CatalogType: String, CaseIterable, Comparable, Decodable { // swiftlint:disable:next cyclomatic_complexity func url(for seedType: CatalogSeedType) -> String { - switch self { case .sonoma: switch seedType { diff --git a/Mist/Model/Chunklist.swift b/Mist/Model/Chunklist.swift index f0c44d0..9bfd4d6 100644 --- a/Mist/Model/Chunklist.swift +++ b/Mist/Model/Chunklist.swift @@ -9,7 +9,6 @@ import Foundation /// Struct used to store all elements of the Chunklist. struct Chunklist { - /// Chunklist Magic Header constant static let magicHeader: UInt32 = 0x4C4B4E43 /// Chunklist Header Size constant @@ -56,7 +55,6 @@ struct Chunklist { /// /// - Throws: A `MistError` if the Chunklist validation fails init(from url: URL, size: Int) throws { - let data: Data = try Data(contentsOf: url) guard data.count == size else { @@ -121,7 +119,6 @@ struct Chunklist { /// /// - Returns: An array of Chunk structs. private static func chunks(_ array: [UInt8], totalChunks: Int) -> [Chunk] { - var chunks: [Chunk] = [] for offset in 0.. [String] { - guard let architecture: Architecture = Hardware.architecture, architecture == .appleSilicon, let modelIdentifier: String = Hardware.modelIdentifier, @@ -134,7 +131,6 @@ struct Firmware: Decodable, Hashable, Identifiable { } extension Firmware: Equatable { - static func == (lhs: Firmware, rhs: Firmware) -> Bool { lhs.version == rhs.version && lhs.build == rhs.build } diff --git a/Mist/Model/Hardware.swift b/Mist/Model/Hardware.swift index 9c0000a..a4748b7 100644 --- a/Mist/Model/Hardware.swift +++ b/Mist/Model/Hardware.swift @@ -9,7 +9,6 @@ import Foundation /// Hardware Struct used to retrieve Hardware information. struct Hardware { - /// Hardware Architecture (Apple Silicon or Intel). static var architecture: Architecture? { #if arch(arm64) @@ -27,7 +26,6 @@ struct Hardware { } /// Hardware Device ID (Apple Silicon or Intel T2). static var deviceID: String? { - switch architecture { case .appleSilicon: return registryProperty(for: "compatible")?.components(separatedBy: "\0").first?.uppercased() @@ -49,7 +47,6 @@ struct Hardware { /// /// - Returns: The entity property for the provided key. private static func registryProperty(for key: String) -> String? { - let entry: io_service_t = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice")) defer { diff --git a/Mist/Model/Installer.swift b/Mist/Model/Installer.swift index ebc572c..366f4f2 100644 --- a/Mist/Model/Installer.swift +++ b/Mist/Model/Installer.swift @@ -10,7 +10,6 @@ import Foundation // swiftlint:disable file_length // swiftlint:disable:next type_body_length struct Installer: Decodable, Hashable, Identifiable { - enum CodingKeys: String, CodingKey { case id = "Identifier" case version = "Version" @@ -654,7 +653,6 @@ struct Installer: Decodable, Hashable, Identifiable { let deviceIDs: [String] let unsupportedModelIdentifiers: [String] var name: String { - var name: String = "" if version.range(of: "^14", options: .regularExpression) != nil { @@ -710,7 +708,6 @@ struct Installer: Decodable, Hashable, Identifiable { // Model Identifier (Apple Silicon or Intel) // macOS Catalina 10.15 or older if version.range(of: "^10\\.", options: .regularExpression) != nil { - if let architecture: Architecture = Hardware.architecture, architecture == .appleSilicon { return false @@ -790,7 +787,6 @@ struct Installer: Decodable, Hashable, Identifiable { } extension Installer: Equatable { - static func == (lhs: Installer, rhs: Installer) -> Bool { lhs.version == rhs.version && lhs.build == rhs.build } diff --git a/Mist/Model/MistTask.swift b/Mist/Model/MistTask.swift index 800ceef..68f6601 100644 --- a/Mist/Model/MistTask.swift +++ b/Mist/Model/MistTask.swift @@ -16,7 +16,6 @@ struct MistTask: Identifiable { let operation: @Sendable () async throws -> Void var currentDescription: String { - var prefix: String = type.rawValue var suffix: String = description @@ -46,14 +45,12 @@ struct MistTask: Identifiable { } extension MistTask: Equatable { - static func == (lhs: MistTask, rhs: MistTask) -> Bool { lhs.id == rhs.id } } extension MistTask: Hashable { - func hash(into hasher: inout Hasher) { hasher.combine(id) } diff --git a/Mist/UserNotificationCenterDelegate.swift b/Mist/UserNotificationCenterDelegate.swift index db9d265..2846c74 100644 --- a/Mist/UserNotificationCenterDelegate.swift +++ b/Mist/UserNotificationCenterDelegate.swift @@ -9,9 +9,7 @@ import AppKit import UserNotifications class UserNotificationCenterDelegate: NSObject, UNUserNotificationCenterDelegate { - func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async { - guard response.actionIdentifier == UNNotificationAction.Identifier.show, let string: String = response.notification.request.content.userInfo["URL"] as? String else { return diff --git a/Mist/Views/Activity/ActivityView.swift b/Mist/Views/Activity/ActivityView.swift index c5dc1b7..e63982f 100644 --- a/Mist/Views/Activity/ActivityView.swift +++ b/Mist/Views/Activity/ActivityView.swift @@ -126,7 +126,6 @@ struct ActivityView: View { } private func performTasks() async { - for taskGroupIndex in taskManager.taskGroups.indices { for taskIndex in taskManager.taskGroups[taskGroupIndex].tasks.indices { currentTaskId = "\(taskManager.taskGroups[taskGroupIndex].section.id).\(taskIndex)" @@ -165,7 +164,6 @@ struct ActivityView: View { } if showInFinder { - guard let url: URL = destinationURL else { return } @@ -175,7 +173,6 @@ struct ActivityView: View { } private func checkForUserCancellation(_ failure: Error) -> Bool { - if failure as? CancellationError != nil { return true } @@ -214,7 +211,6 @@ struct ActivityView: View { } private func stop() { - switch taskManager.currentState { case .pending, .inProgress: alertType = .cancel diff --git a/Mist/Views/Components/PathControl.swift b/Mist/Views/Components/PathControl.swift index bf8b0ec..32dad29 100644 --- a/Mist/Views/Components/PathControl.swift +++ b/Mist/Views/Components/PathControl.swift @@ -8,7 +8,6 @@ import SwiftUI struct PathControl: NSViewRepresentable { - @Binding var path: String func makeNSView(context: Context) -> NSPathControl { diff --git a/Mist/Views/Components/TextFieldStepperView.swift b/Mist/Views/Components/TextFieldStepperView.swift index 65122f0..4645208 100644 --- a/Mist/Views/Components/TextFieldStepperView.swift +++ b/Mist/Views/Components/TextFieldStepperView.swift @@ -33,14 +33,12 @@ struct TextFieldStepperView: View { } private func increment() { - if value < maximum { value += 1 } } private func decrement() { - if value > minimum { value -= 1 } diff --git a/Mist/Views/ContentView.swift b/Mist/Views/ContentView.swift index 334ed6e..1474fff 100644 --- a/Mist/Views/ContentView.swift +++ b/Mist/Views/ContentView.swift @@ -124,14 +124,12 @@ struct ContentView: View { } private func releaseNames(for type: DownloadType) -> [String] { - var releaseNames: [String] = [] switch type { case .firmware: for firmware in filteredFirmwares { - let releaseName: String = firmware.name.replacingOccurrences(of: " beta", with: "") if !releaseNames.contains(releaseName) { @@ -141,7 +139,6 @@ struct ContentView: View { case .installer: for installer in filteredInstallers { - let releaseName: String = installer.name.replacingOccurrences(of: " beta", with: "") if !releaseNames.contains(releaseName) { diff --git a/Mist/Views/FooterView.swift b/Mist/Views/FooterView.swift index 2e63a4f..55c8468 100644 --- a/Mist/Views/FooterView.swift +++ b/Mist/Views/FooterView.swift @@ -33,7 +33,6 @@ struct FooterView: View { } private func export() { - dateFormatter.dateFormat = "yyyy-MM-dd" let date: String = dateFormatter.string(from: Date()) diff --git a/Mist/Views/List/InstallerExportView.swift b/Mist/Views/List/InstallerExportView.swift index aa32c11..9494ae9 100644 --- a/Mist/Views/List/InstallerExportView.swift +++ b/Mist/Views/List/InstallerExportView.swift @@ -70,7 +70,6 @@ struct InstallerExportView: View { } private func updateExports() { - var exports: [InstallerExportType] = [] if !isoCompatible && exportISO { diff --git a/Mist/Views/List/InstallerVolumeSelectionView.swift b/Mist/Views/List/InstallerVolumeSelectionView.swift index ca94f3f..8ad1db3 100644 --- a/Mist/Views/List/InstallerVolumeSelectionView.swift +++ b/Mist/Views/List/InstallerVolumeSelectionView.swift @@ -62,7 +62,6 @@ struct InstallerVolumeSelectionView: View { } private func getAvailableVolumes() -> [InstallerVolume] { - var volumes: [InstallerVolume] = [] let keys: [URLResourceKey] = [.volumeNameKey, .volumeLocalizedFormatDescriptionKey, .volumeIsReadOnlyKey, .volumeTotalCapacityKey] diff --git a/Mist/Views/List/ListRowFirmware.swift b/Mist/Views/List/ListRowFirmware.swift index 102b0cb..2361a13 100644 --- a/Mist/Views/List/ListRowFirmware.swift +++ b/Mist/Views/List/ListRowFirmware.swift @@ -28,7 +28,6 @@ struct ListRowFirmware: View { private let spacing: CGFloat = 5 private let padding: CGFloat = 3 private var compatibilityMessage: String { - guard let architecture: Architecture = Hardware.architecture else { return "Invalid architecture!" } @@ -36,7 +35,6 @@ struct ListRowFirmware: View { return "This macOS Firmware download cannot be used to restore macOS on this \(architecture.description) Mac.\n\nAre you sure you want to continue?" } private var errorMessage: String { - if let error: BlessError = error as? BlessError { return error.description } @@ -136,7 +134,6 @@ struct ListRowFirmware: View { } private func validate() { - guard PrivilegedHelperTool.isInstalled() else { alertType = .helperTool showAlert = true @@ -158,7 +155,6 @@ struct ListRowFirmware: View { } struct ListRowFirmware_Previews: PreviewProvider { - static var previews: some View { ListRowFirmware(firmware: .example, savePanel: .constant(NSSavePanel()), tasksInProgress: .constant(false), taskManager: .shared) } diff --git a/Mist/Views/List/ListRowInstaller.swift b/Mist/Views/List/ListRowInstaller.swift index 9be0694..5771787 100644 --- a/Mist/Views/List/ListRowInstaller.swift +++ b/Mist/Views/List/ListRowInstaller.swift @@ -53,7 +53,6 @@ struct ListRowInstaller: View { private let spacing: CGFloat = 5 private let padding: CGFloat = 3 private var compatibilityMessage: String { - guard let architecture: Architecture = Hardware.architecture else { return "Invalid architecture!" } @@ -64,7 +63,6 @@ struct ListRowInstaller: View { "The cache directory has incorrect ownership and/or permissions, which will cause issues caching macOS Installers.\n\nRepair the cache directory ownership and/or permissions and try again." } private var errorMessage: String { - if let error: BlessError = error as? BlessError { return error.description } @@ -203,7 +201,6 @@ struct ListRowInstaller: View { } private func createBootableInstaller() { - guard let volume: InstallerVolume = volume else { return } @@ -230,7 +227,6 @@ struct ListRowInstaller: View { } private func validate() { - guard PrivilegedHelperTool.isInstalled() else { alertType = .helperTool showAlert = true @@ -244,7 +240,6 @@ struct ListRowInstaller: View { } if cacheDownloads { - do { var isDirectory: ObjCBool = false @@ -299,7 +294,6 @@ struct ListRowInstaller: View { } private func openFullDiskAccessPreferences() { - guard let url: URL = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") else { return } diff --git a/Mist/Views/Refresh/RefreshView.swift b/Mist/Views/Refresh/RefreshView.swift index beedb5b..b48f3c5 100644 --- a/Mist/Views/Refresh/RefreshView.swift +++ b/Mist/Views/Refresh/RefreshView.swift @@ -98,7 +98,6 @@ struct RefreshView: View { } private func retrieveFirmwares() throws -> [Firmware] { - var firmwares: [Firmware] = [] guard let firmwaresURL: URL = URL(string: Firmware.firmwaresURL) else { @@ -119,7 +118,6 @@ struct RefreshView: View { let supportedBuilds: [String] = try Firmware.supportedBuilds() for (identifier, device) in devices { - guard identifier.contains("Mac"), let device: [String: Any] = device as? [String: Any], let firmwaresArray: [[String: Any]] = device["firmwares"] as? [[String: Any]] else { @@ -127,7 +125,6 @@ struct RefreshView: View { } for var firmwareDictionary in firmwaresArray { - if let url: String = firmwareDictionary["url"] as? String, url.contains("http://updates-http.cdn-apple.com") { firmwareDictionary["url"] = url.replacingOccurrences(of: "http://updates-http.cdn-apple.com", with: "https://updates.cdn-apple.com") @@ -156,7 +153,6 @@ struct RefreshView: View { let catalogURLs: [String] = getCatalogURLs() for catalogURL in catalogURLs { - guard let url: URL = URL(string: catalogURL) else { continue } @@ -196,7 +192,6 @@ struct RefreshView: View { } private func getCatalogURLs() -> [String] { - var catalogURLs: [String] = [] var catalogs: [Catalog] = [] let defaultCatalogs: [Catalog] = CatalogType.allCases.map { Catalog(type: $0, standard: true, customerSeed: false, developerSeed: false, publicSeed: false) } @@ -239,13 +234,11 @@ struct RefreshView: View { } private func getInstallers(from dictionary: [String: Any]) -> [Installer] { - var installers: [Installer] = [] let dateFormatter: DateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd" for (key, value) in dictionary { - guard var value: [String: Any] = value as? [String: Any], let date: Date = value["PostDate"] as? Date, let extendedMetaInfo: [String: Any] = value["ExtendedMetaInfo"] as? [String: Any], @@ -296,7 +289,6 @@ struct RefreshView: View { } private func nameFromDistribution(_ string: String) -> String? { - guard string.contains("suDisabledGroupID") else { return nil } @@ -307,7 +299,6 @@ struct RefreshView: View { } private func versionFromDistribution(_ string: String) -> String? { - guard string.contains("VERSION") else { return nil } @@ -317,7 +308,6 @@ struct RefreshView: View { } private func buildFromDistribution(_ string: String) -> String? { - guard string.contains("BUILD") else { return nil } @@ -327,7 +317,6 @@ struct RefreshView: View { } private func boardIDsFromDistribution(_ string: String) -> [String] { - guard string.contains("supportedBoardIDs") || string.contains("boardIds") else { return [] } @@ -341,7 +330,6 @@ struct RefreshView: View { } private func deviceIDsFromDistribution(_ string: String) -> [String] { - guard string.contains("supportedDeviceIDs") else { return [] } @@ -356,7 +344,6 @@ struct RefreshView: View { } private func unsupportedModelIdentifiersFromDistribution(_ string: String) -> [String] { - guard string.contains("nonSupportedModels") else { return [] } diff --git a/Mist/Views/Settings/SettingsAboutView.swift b/Mist/Views/Settings/SettingsAboutView.swift index fb00050..0890a5a 100644 --- a/Mist/Views/Settings/SettingsAboutView.swift +++ b/Mist/Views/Settings/SettingsAboutView.swift @@ -49,7 +49,6 @@ struct SettingsAboutView: View { } private func visitHomepage() { - guard let url: URL = URL(string: .repositoryURL) else { return } diff --git a/Mist/Views/Settings/SettingsDiskImagesView.swift b/Mist/Views/Settings/SettingsDiskImagesView.swift index 6e061a6..611f007 100644 --- a/Mist/Views/Settings/SettingsDiskImagesView.swift +++ b/Mist/Views/Settings/SettingsDiskImagesView.swift @@ -48,7 +48,6 @@ struct SettingsDiskImagesView: View { } private func updateCodesigningIdentities() { - var codesigningIdentities: [String] = [] let query: [String: Any] = [ diff --git a/Mist/Views/Settings/SettingsGeneralHelperView.swift b/Mist/Views/Settings/SettingsGeneralHelperView.swift index 347c3f7..524bbc2 100644 --- a/Mist/Views/Settings/SettingsGeneralHelperView.swift +++ b/Mist/Views/Settings/SettingsGeneralHelperView.swift @@ -19,7 +19,6 @@ struct SettingsGeneralHelperView: View { @State private var error: Error? private let length: CGFloat = 16 private var status: String { - guard installed, let installed: HelperToolInfoPropertyList = installedInfoPropertyList else { return "Not Installed" @@ -29,7 +28,6 @@ struct SettingsGeneralHelperView: View { return "Installed (\(version.major).\(version.minor).\(version.patch))" } private var errorMessage: String { - if let error: BlessError = error as? BlessError { return error.description } @@ -70,7 +68,6 @@ struct SettingsGeneralHelperView: View { } private func install() { - processing = true do { diff --git a/Mist/Views/Settings/SettingsGeneralNotificationsView.swift b/Mist/Views/Settings/SettingsGeneralNotificationsView.swift index c4cd5bf..31b1cff 100644 --- a/Mist/Views/Settings/SettingsGeneralNotificationsView.swift +++ b/Mist/Views/Settings/SettingsGeneralNotificationsView.swift @@ -44,7 +44,6 @@ struct SettingsGeneralNotificationsView: View { } private func validateNotifications() { - let notificationCenter: UNUserNotificationCenter = .current() notificationCenter.getNotificationSettings { settings in @@ -56,7 +55,6 @@ struct SettingsGeneralNotificationsView: View { } private func request() { - let userNotificationCenter: UNUserNotificationCenter = UNUserNotificationCenter.current() let options: UNAuthorizationOptions = [.alert, .badge, .sound] @@ -71,7 +69,6 @@ struct SettingsGeneralNotificationsView: View { } private func openNotifications() { - guard let url: URL = URL(string: "x-apple.systempreferences:com.apple.preference.notifications?Notifications") else { return } diff --git a/Mist/Views/Settings/SettingsInstallersCacheView.swift b/Mist/Views/Settings/SettingsInstallersCacheView.swift index 3a44925..2148af8 100644 --- a/Mist/Views/Settings/SettingsInstallersCacheView.swift +++ b/Mist/Views/Settings/SettingsInstallersCacheView.swift @@ -106,7 +106,6 @@ struct SettingsInstallersCacheView: View { } private func retrieveCache() { - let url: URL = URL(fileURLWithPath: cacheDirectory) var isDirectory: ObjCBool = false @@ -143,7 +142,6 @@ struct SettingsInstallersCacheView: View { } private func installer(for url: URL) -> Installer? { - let id: String = url.lastPathComponent do { @@ -194,7 +192,6 @@ struct SettingsInstallersCacheView: View { } private func versionFromDistribution(_ string: String) -> String? { - guard string.contains("VERSION") else { return nil } @@ -204,7 +201,6 @@ struct SettingsInstallersCacheView: View { } private func buildFromDistribution(_ string: String) -> String? { - guard string.contains("BUILD") else { return nil } @@ -214,7 +210,6 @@ struct SettingsInstallersCacheView: View { } private func showInFinder() { - guard let id: String = selectedInstallerId else { return } @@ -224,7 +219,6 @@ struct SettingsInstallersCacheView: View { } private func emptyCache(for id: String?) async { - guard let id: String = id else { return } diff --git a/Mist/Views/Settings/SettingsInstallersView.swift b/Mist/Views/Settings/SettingsInstallersView.swift index 5f570a2..b80e769 100644 --- a/Mist/Views/Settings/SettingsInstallersView.swift +++ b/Mist/Views/Settings/SettingsInstallersView.swift @@ -42,7 +42,6 @@ struct SettingsInstallersView: View { } private func getCatalogs() -> [Catalog] { - guard let array: [[String: Any]] = UserDefaults.standard.array(forKey: "catalogs") as? [[String: Any]] else { return defaultCatalogs } diff --git a/Mist/Views/Settings/SettingsPackagesView.swift b/Mist/Views/Settings/SettingsPackagesView.swift index a2beacb..ce38c1e 100644 --- a/Mist/Views/Settings/SettingsPackagesView.swift +++ b/Mist/Views/Settings/SettingsPackagesView.swift @@ -61,7 +61,6 @@ struct SettingsPackagesView: View { } private func updateCodesigningIdentities() { - var codesigningIdentities: [String] = [] let query: [String: Any] = [ diff --git a/MistHelperTool/main.swift b/MistHelperTool/main.swift index 9f11360..64e92f0 100644 --- a/MistHelperTool/main.swift +++ b/MistHelperTool/main.swift @@ -10,7 +10,6 @@ import SecureXPC /// Helper Tool struct to run a command sent from the main application. struct HelperToolCommandRunner { - /// Run the requested command and return the status and output. /// /// - Parameters: @@ -20,7 +19,6 @@ struct HelperToolCommandRunner { /// /// - Returns: A `HelperToolCommandResponse` struct containing the termination status, standard output and standard error. static func run(_ request: HelperToolCommandRequest) throws -> HelperToolCommandResponse { - switch request.type { case .remove: diff --git a/MistTests/MistTests.swift b/MistTests/MistTests.swift index bfca38d..a8373bb 100644 --- a/MistTests/MistTests.swift +++ b/MistTests/MistTests.swift @@ -8,7 +8,6 @@ import XCTest final class MistTests: XCTestCase { - func test() throws { XCTAssertTrue(true) } diff --git a/Shared/HelperToolInfoPropertyList.swift b/Shared/HelperToolInfoPropertyList.swift index 4ce37cb..822032e 100644 --- a/Shared/HelperToolInfoPropertyList.swift +++ b/Shared/HelperToolInfoPropertyList.swift @@ -9,7 +9,6 @@ import EmbeddedPropertyList import Foundation struct HelperToolInfoPropertyList: Decodable, Equatable { - private enum CodingKeys: String, CodingKey { case buildHash = "BuildHash" case bundleIdentifier = "CFBundleIdentifier" diff --git a/Shared/HelperToolLaunchdPropertyList.swift b/Shared/HelperToolLaunchdPropertyList.swift index 1ee9720..93e0f4f 100644 --- a/Shared/HelperToolLaunchdPropertyList.swift +++ b/Shared/HelperToolLaunchdPropertyList.swift @@ -9,7 +9,6 @@ import EmbeddedPropertyList import Foundation struct HelperToolLaunchdPropertyList: Decodable, Equatable { - private enum CodingKeys: String, CodingKey { case machServices = "MachServices" case label = "Label" diff --git a/Shared/ShellExecutor.swift b/Shared/ShellExecutor.swift index ae0176d..506b8f1 100644 --- a/Shared/ShellExecutor.swift +++ b/Shared/ShellExecutor.swift @@ -9,7 +9,6 @@ import Foundation /// Helper class used to execute shell commands. class ShellExecutor: NSObject { - static var shared: ShellExecutor = ShellExecutor() private var process: Process = Process() @@ -60,7 +59,6 @@ class ShellExecutor: NSObject { } func terminate() { - guard process.isRunning else { return }