Skip to content

Commit

Permalink
Enable Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Jun 11, 2024
1 parent 57082e3 commit fca40c0
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 57 deletions.
30 changes: 21 additions & 9 deletions Whisky.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1500;
LastUpgradeCheck = 1420;
LastUpgradeCheck = 1600;
TargetAttributes = {
6E40495129CCA19C006E3F1B = {
CreatedOnToolsVersion = 14.2;
Expand Down Expand Up @@ -685,6 +685,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -748,6 +749,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -772,7 +774,6 @@
6E40497829CCA19D006E3F1B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand All @@ -781,6 +782,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 40;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Whisky/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
Expand All @@ -803,14 +805,14 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
6E40497929CCA19D006E3F1B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand All @@ -819,6 +821,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 40;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Whisky/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
Expand All @@ -842,7 +845,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = Whisky;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand All @@ -853,6 +857,7 @@
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -867,7 +872,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -878,6 +884,7 @@
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -891,7 +898,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand All @@ -903,6 +911,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 40;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -925,7 +934,8 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand All @@ -937,6 +947,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 40;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = 92S3SG4PTH;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -958,7 +969,8 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Whisky.xcodeproj/xcshareddata/xcschemes/Whisky.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Whisky.xcodeproj/xcshareddata/xcschemes/WhiskyCmd.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1600"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 2 additions & 1 deletion Whisky/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
Bundle.main.resourceURL?.deletingLastPathComponent().deletingLastPathComponent()
}

private static var expectedUrl = URL(fileURLWithPath: "/Applications/Whisky.app")
private static let expectedUrl = URL(fileURLWithPath: "/Applications/Whisky.app")

private static var insideAppsFolder: Bool {
if let url = appUrl {
Expand All @@ -65,6 +65,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
return false
}

@MainActor
private func showAlertOnFirstLaunch() {
let alert = NSAlert()
alert.messageText = String(localized: "showAlertOnFirstLaunch.messageText")
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Utils/Winetricks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Winetricks {

do {
let (data, _) = try await URLSession.shared.data(from: verbsURL)
verbs = String(data: data, encoding: .utf8)
verbs = String(decoding: data, as: UTF8.self)
} catch {
return []
}
Expand Down
6 changes: 4 additions & 2 deletions Whisky/View Models/BottleVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import Foundation
import SemanticVersion
import WhiskyKit

class BottleVM: ObservableObject {
static let shared = BottleVM()
// swiftlint:disable:next todo
// TODO: Don't use unchecked!
final class BottleVM: ObservableObject, @unchecked Sendable {
@MainActor static let shared = BottleVM()

var bottlesList = BottleData()
@Published var bottles: [Bottle] = []
Expand Down
3 changes: 2 additions & 1 deletion Whisky/Views/Bottle/BottleListEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ struct BottleListEntry: View {
if selected == bottle.url {
selected = nil
}
await bottle.remove(delete: checkbox.state == .on)

bottle.remove(delete: checkbox.state == .on)
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion Whisky/Views/Bottle/WinetricksView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ struct WinetricksView: View {
.padding()
.onAppear {
Task.detached {
winetricks = await Winetricks.parseVerbs()
let tricks = await Winetricks.parseVerbs()

await MainActor.run {
winetricks = tricks
}
}
}
.frame(minWidth: ViewWidth.large, minHeight: 400)
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import SwiftUI
import UniformTypeIdentifiers
import WhiskyKit
import SemanticVersion
@preconcurrency import SemanticVersion

struct ContentView: View {
@AppStorage("selectedBottleURL") private var selectedBottleURL: URL?
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/FileOpenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct FileOpenView: View {
if let bottle = bottles.first(where: { $0.url == selection }) {
Task.detached(priority: .userInitiated) {
do {
if fileURL.pathExtension == "bat" {
if await fileURL.pathExtension == "bat" {
try await Wine.runBatchFile(url: fileURL,
bottle: bottle)
} else {
Expand Down
4 changes: 2 additions & 2 deletions Whisky/Views/Setup/RosettaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ struct RosettaView: View {
if Rosetta2.isRosettaInstalled {
installing = false
sleep(2)
await proceed()
proceed()
} else {
do {
successful = try await Rosetta2.installRosetta()
installing = false
try await Task.sleep(for: .seconds(2))
await proceed()
proceed()
} catch {
successful = false
installing = false
Expand Down
10 changes: 7 additions & 3 deletions Whisky/Views/Setup/WhiskyWineDownloadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ struct WhiskyWineDownloadView: View {
Task {
if let url: URL = URL(string: "https://data.getwhisky.app/Wine/Libraries.tar.gz") {
downloadTask = URLSession(configuration: .ephemeral).downloadTask(with: url) { url, _, _ in
if let url = url {
tarLocation = url
proceed()
Task.detached {
await MainActor.run {
if let url = url {
tarLocation = url
proceed()
}
}
}
}
observation = downloadTask?.observe(\.countOfBytesReceived) { task, _ in
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Setup/WhiskyWineInstallView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct WhiskyWineInstallView: View {
.frame(width: 400, height: 200)
.onAppear {
Task.detached {
WhiskyWineInstaller.install(from: tarLocation)
await WhiskyWineInstaller.install(from: tarLocation)
await MainActor.run {
installing = false
}
Expand Down
4 changes: 1 addition & 3 deletions Whisky/Views/WhiskyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ struct WhiskyApp: App {
getconf.waitUntilExit()

let getconfOutput = pipe.fileHandleForReading.readDataToEndOfFile()
guard let getconfOutputString = String(data: getconfOutput, encoding: .utf8) else {
return
}
let getconfOutputString = String(decoding: getconfOutput, as: UTF8.self)

let d3dmPath = URL(fileURLWithPath: getconfOutputString.trimmingCharacters(in: .whitespacesAndNewlines))
.appending(path: "d3dm").path
Expand Down
Loading

1 comment on commit fca40c0

@kambala-decapitator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not clear why this is in the main branch as it breaks building with Xcode 15.4 (official release). Beta stuff should either be in a branch or hidden under a feature flag.

Please sign in to comment.