Skip to content

Commit 52258dc

Browse files
authored
Update case studies to run in Swift 6 mode. (#3394)
1 parent 6dc5f98 commit 52258dc

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

Examples/CaseStudies/CaseStudies.xcodeproj/project.pbxproj

+7-11
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@
598598
attributes = {
599599
BuildIndependentTargetsInParallel = YES;
600600
LastSwiftUpdateCheck = 1150;
601-
LastUpgradeCheck = 1520;
601+
LastUpgradeCheck = 1600;
602602
ORGANIZATIONNAME = "Point-Free";
603603
TargetAttributes = {
604604
CAF88E6F24B8E26D00539345 = {
@@ -880,7 +880,6 @@
880880
CAF88E8C24B8E26E00539345 /* Debug */ = {
881881
isa = XCBuildConfiguration;
882882
buildSettings = {
883-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
884883
BUNDLE_LOADER = "$(TEST_HOST)";
885884
CODE_SIGN_STYLE = Automatic;
886885
INFOPLIST_FILE = tvOSCaseStudies/Info.plist;
@@ -901,7 +900,6 @@
901900
CAF88E8D24B8E26E00539345 /* Release */ = {
902901
isa = XCBuildConfiguration;
903902
buildSettings = {
904-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
905903
BUNDLE_LOADER = "$(TEST_HOST)";
906904
CODE_SIGN_STYLE = Automatic;
907905
INFOPLIST_FILE = tvOSCaseStudies/Info.plist;
@@ -960,7 +958,6 @@
960958
DC4C6EC72450DD390066A05D /* Debug */ = {
961959
isa = XCBuildConfiguration;
962960
buildSettings = {
963-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
964961
BUNDLE_LOADER = "$(TEST_HOST)";
965962
CODE_SIGN_STYLE = Automatic;
966963
INFOPLIST_FILE = UIKitCaseStudies/Info.plist;
@@ -980,7 +977,6 @@
980977
DC4C6EC82450DD390066A05D /* Release */ = {
981978
isa = XCBuildConfiguration;
982979
buildSettings = {
983-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
984980
BUNDLE_LOADER = "$(TEST_HOST)";
985981
CODE_SIGN_STYLE = Automatic;
986982
INFOPLIST_FILE = UIKitCaseStudies/Info.plist;
@@ -1001,6 +997,7 @@
1001997
isa = XCBuildConfiguration;
1002998
buildSettings = {
1003999
ALWAYS_SEARCH_USER_PATHS = NO;
1000+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
10041001
CLANG_ANALYZER_NONNULL = YES;
10051002
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
10061003
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1063,6 +1060,7 @@
10631060
isa = XCBuildConfiguration;
10641061
buildSettings = {
10651062
ALWAYS_SEARCH_USER_PATHS = NO;
1063+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
10661064
CLANG_ANALYZER_NONNULL = YES;
10671065
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
10681066
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@@ -1128,7 +1126,7 @@
11281126
);
11291127
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudies;
11301128
PRODUCT_NAME = "$(TARGET_NAME)";
1131-
SWIFT_VERSION = 5.0;
1129+
SWIFT_VERSION = 6.0;
11321130
TARGETED_DEVICE_FAMILY = "1,2";
11331131
};
11341132
name = Debug;
@@ -1146,15 +1144,14 @@
11461144
);
11471145
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudies;
11481146
PRODUCT_NAME = "$(TARGET_NAME)";
1149-
SWIFT_VERSION = 5.0;
1147+
SWIFT_VERSION = 6.0;
11501148
TARGETED_DEVICE_FAMILY = "1,2";
11511149
};
11521150
name = Release;
11531151
};
11541152
DC89C43624460F96006900B9 /* Debug */ = {
11551153
isa = XCBuildConfiguration;
11561154
buildSettings = {
1157-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
11581155
BUNDLE_LOADER = "$(TEST_HOST)";
11591156
CODE_SIGN_STYLE = Automatic;
11601157
INFOPLIST_FILE = SwiftUICaseStudies/Info.plist;
@@ -1165,7 +1162,7 @@
11651162
);
11661163
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudiesTests;
11671164
PRODUCT_NAME = "$(TARGET_NAME)";
1168-
SWIFT_VERSION = 5.0;
1165+
SWIFT_VERSION = 6.0;
11691166
TARGETED_DEVICE_FAMILY = "1,2";
11701167
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUICaseStudies.app/SwiftUICaseStudies";
11711168
};
@@ -1174,7 +1171,6 @@
11741171
DC89C43724460F96006900B9 /* Release */ = {
11751172
isa = XCBuildConfiguration;
11761173
buildSettings = {
1177-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
11781174
BUNDLE_LOADER = "$(TEST_HOST)";
11791175
CODE_SIGN_STYLE = Automatic;
11801176
INFOPLIST_FILE = SwiftUICaseStudies/Info.plist;
@@ -1185,7 +1181,7 @@
11851181
);
11861182
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudiesTests;
11871183
PRODUCT_NAME = "$(TARGET_NAME)";
1188-
SWIFT_VERSION = 5.0;
1184+
SWIFT_VERSION = 6.0;
11891185
TARGETED_DEVICE_FAMILY = "1,2";
11901186
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUICaseStudies.app/SwiftUICaseStudies";
11911187
};

Examples/CaseStudies/SwiftUICaseStudies/03-Effects-LongLiving.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension DependencyValues {
5656

5757
private enum ScreenshotsKey: DependencyKey {
5858
static let liveValue: @Sendable () async -> AsyncStream<Void> = {
59-
await AsyncStream(
59+
AsyncStream(
6060
NotificationCenter.default
6161
.notifications(named: UIApplication.userDidTakeScreenshotNotification)
6262
.map { _ in }

Examples/CaseStudies/SwiftUICaseStudies/05-HigherOrderReducers-ResuableOfflineDownloads/DownloadComponent.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct DownloadComponent {
66
@ObservableState
77
struct State: Equatable {
88
@Presents var alert: AlertState<Action.Alert>?
9-
let id: AnyHashable
9+
let id: AnyHashableSendable
1010
var mode: Mode = .notDownloaded
1111
let url: URL
1212
}
@@ -185,7 +185,7 @@ struct DownloadComponentView: View {
185185
DownloadComponentView(
186186
store: Store(
187187
initialState: DownloadComponent.State(
188-
id: "deadbeef",
188+
id: AnyHashableSendable("deadbeef"),
189189
mode: .notDownloaded,
190190
url: URL(fileURLWithPath: "/")
191191
)

Examples/CaseStudies/SwiftUICaseStudies/05-HigherOrderReducers-ResuableOfflineDownloads/ReusableComponents-Download.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct CityMap {
2424
init(download: Download) {
2525
self.download = download
2626
self.downloadComponent = DownloadComponent.State(
27-
id: download.id,
27+
id: AnyHashableSendable(download.id),
2828
url: download.downloadVideoUrl
2929
)
3030
}

Examples/CaseStudies/SwiftUICaseStudies/05-HigherOrderReducers-ReusableFavoriting.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ enum FavoritingAction {
3737
struct Favoriting<ID: Hashable & Sendable> {
3838
let favorite: @Sendable (ID, Bool) async throws -> Bool
3939

40-
private struct CancelID: Hashable {
41-
let id: AnyHashable
40+
private struct CancelID: Hashable, Sendable {
41+
let id: AnyHashableSendable
4242
}
4343

4444
var body: some Reducer<FavoritingState<ID>, FavoritingAction> {
@@ -55,7 +55,7 @@ struct Favoriting<ID: Hashable & Sendable> {
5555
return .run { [id = state.id, isFavorite = state.isFavorite, favorite] send in
5656
await send(.response(Result { try await favorite(id, isFavorite) }))
5757
}
58-
.cancellable(id: CancelID(id: state.id), cancelInFlight: true)
58+
.cancellable(id: CancelID(id: AnyHashableSendable(state.id)), cancelInFlight: true)
5959

6060
case let .response(.failure(error)):
6161
state.alert = AlertState { TextState(error.localizedDescription) }

Examples/CaseStudies/SwiftUICaseStudies/FactClient.swift

+7
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ extension FactClient: DependencyKey {
3030
/// to prove do not need the dependency.
3131
static let testValue = Self()
3232
}
33+
34+
struct AnyHashableSendable: Hashable, @unchecked Sendable {
35+
let base: AnyHashable
36+
init<Base: Hashable & Sendable>(_ base: Base) {
37+
self.base = base
38+
}
39+
}

Examples/CaseStudies/SwiftUICaseStudiesTests/05-HigherOrderReducers-ReusableOfflineDownloadsTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ final class ReusableComponentsDownloadComponentTests: XCTestCase {
88
let download = AsyncThrowingStream.makeStream(of: DownloadClient.Event.self)
99
let store = await TestStore(
1010
initialState: DownloadComponent.State(
11-
id: 1,
11+
id: AnyHashableSendable(1),
1212
mode: .notDownloaded,
1313
url: URL(string: "https://www.pointfree.co")!
1414
)
@@ -38,7 +38,7 @@ final class ReusableComponentsDownloadComponentTests: XCTestCase {
3838
let download = AsyncThrowingStream.makeStream(of: DownloadClient.Event.self)
3939
let store = await TestStore(
4040
initialState: DownloadComponent.State(
41-
id: 1,
41+
id: AnyHashableSendable(1),
4242
mode: .notDownloaded,
4343
url: URL(string: "https://www.pointfree.co")!
4444
)
@@ -80,7 +80,7 @@ final class ReusableComponentsDownloadComponentTests: XCTestCase {
8080
let download = AsyncThrowingStream.makeStream(of: DownloadClient.Event.self)
8181
let store = await TestStore(
8282
initialState: DownloadComponent.State(
83-
id: 1,
83+
id: AnyHashableSendable(1),
8484
mode: .notDownloaded,
8585
url: URL(string: "https://www.pointfree.co")!
8686
)
@@ -121,7 +121,7 @@ final class ReusableComponentsDownloadComponentTests: XCTestCase {
121121
let download = AsyncThrowingStream.makeStream(of: DownloadClient.Event.self)
122122
let store = await TestStore(
123123
initialState: DownloadComponent.State(
124-
id: 1,
124+
id: AnyHashableSendable(1),
125125
mode: .downloaded,
126126
url: URL(string: "https://www.pointfree.co")!
127127
)

0 commit comments

Comments
 (0)