Skip to content

Commit

Permalink
Turn on Swift 6 mode in examples project. (#247)
Browse files Browse the repository at this point in the history
* Turn of Swift 6 mode in examples project.

* fix

* Use xcode 16.

* wip

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
  • Loading branch information
mbrandonw and stephencelis authored Feb 25, 2025
1 parent 57ab05c commit a488fef
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ jobs:
run: |
PREFIX=/opt/swift
set -ex
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu22.04.tar.gz"
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.3-release/ubuntu2204/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu22.04.tar.gz"
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.tar.gz -C $PREFIX --strip-component 1
$PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.2-RELEASE/swift-wasm-6.0.2-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 6ffedb055cb9956395d9f435d03d53ebe9f6a8d45106b979d1b7f53358e1dcb4
$PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.3-RELEASE/swift-wasm-6.0.3-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 31d3585b06dd92de390bacc18527801480163188cd7473f492956b5e213a8618
echo "$PREFIX/usr/bin" >> $GITHUB_PATH
- name: Build tests
Expand Down
1 change: 1 addition & 0 deletions Examples/CaseStudies/Internal/CaseStudy.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SwiftUI
import UIKitNavigation

@MainActor
protocol CaseStudy {
var readMe: String { get }
var caseStudyTitle: String { get }
Expand Down
24 changes: 12 additions & 12 deletions Examples/CaseStudiesTests/Internal/AssertEventually.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import XCTest

@MainActor
func assertEventuallyEqual<T: Equatable>(
_ expression1: @autoclosure @escaping @MainActor () -> T,
_ expression2: @autoclosure @escaping @MainActor () -> T,
_ expression1: @autoclosure () -> T,
_ expression2: @autoclosure () -> T,
timeout: TimeInterval = 1,
file: StaticString = #file,
line: UInt = #line
Expand All @@ -22,8 +22,8 @@ func assertEventuallyEqual<T: Equatable>(

@MainActor
func assertEventuallyNoDifference<T: Equatable>(
_ expression1: @autoclosure @escaping @MainActor () -> T,
_ expression2: @autoclosure @escaping @MainActor () -> T,
_ expression1: @autoclosure () -> T,
_ expression2: @autoclosure () -> T,
timeout: TimeInterval = 1,
file: StaticString = #file,
line: UInt = #line
Expand Down Expand Up @@ -51,8 +51,8 @@ func assertEventuallyNoDifference<T: Equatable>(

@MainActor
func assertEventuallyNotEqual<T: Equatable>(
_ expression1: @autoclosure @escaping @MainActor () -> T,
_ expression2: @autoclosure @escaping @MainActor () -> T,
_ expression1: @autoclosure () -> T,
_ expression2: @autoclosure () -> T,
timeout: TimeInterval = 1,
file: StaticString = #file,
line: UInt = #line
Expand All @@ -70,7 +70,7 @@ func assertEventuallyNotEqual<T: Equatable>(

@MainActor
func assertEventuallyNil<T>(
_ expression: @autoclosure @escaping @MainActor () -> T?,
_ expression: @autoclosure () -> T?,
timeout: TimeInterval = 1,
file: StaticString = #file,
line: UInt = #line
Expand All @@ -87,7 +87,7 @@ func assertEventuallyNil<T>(

@MainActor
func assertEventuallyNotNil<T>(
_ expression: @autoclosure @escaping @MainActor () -> T?,
_ expression: @autoclosure () -> T?,
timeout: TimeInterval = 1,
file: StaticString = #file,
line: UInt = #line
Expand All @@ -104,8 +104,8 @@ func assertEventuallyNotNil<T>(

@MainActor
private func _assertEventually<T>(
_ expression1: @autoclosure @escaping @MainActor () -> T,
_ expression2: @autoclosure @escaping @MainActor () -> T,
_ expression1: @autoclosure () -> T,
_ expression2: @autoclosure () -> T,
condition: (T, T) -> Bool,
assert: (
@autoclosure () -> T,
Expand Down Expand Up @@ -137,7 +137,7 @@ private func _assertEventually<T>(

@MainActor
private func _assertEventually<T>(
_ expression: @autoclosure @escaping @MainActor () -> T,
_ expression: @autoclosure () -> T,
condition: (T) -> Bool,
assert: (@autoclosure () -> T, @autoclosure () -> String, StaticString, UInt) -> Void,
timeout: TimeInterval,
Expand All @@ -155,6 +155,6 @@ private func _assertEventually<T>(
assert(value, "", file, line)
return
}
await Task.yield()
await Task { try? await Task.sleep(nanoseconds: 1000) }.value
}
}
12 changes: 5 additions & 7 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1540;
LastUpgradeCheck = 1510;
LastUpgradeCheck = 1610;
TargetAttributes = {
CA4737C7272F095F0012CAC3 = {
CreatedOnToolsVersion = 13.1;
Expand Down Expand Up @@ -631,6 +631,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand Down Expand Up @@ -686,6 +687,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -714,7 +716,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -742,7 +743,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Inventory;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -772,7 +772,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -801,7 +800,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.CaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -823,7 +821,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CaseStudies.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/CaseStudies";
};
Expand All @@ -845,7 +842,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.CaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CaseStudies.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/CaseStudies";
};
Expand All @@ -858,6 +854,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -904,6 +901,7 @@
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = 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 = "1540"
LastUpgradeVersion = "1610"
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 = "1510"
LastUpgradeVersion = "1610"
version = "1.3">
<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 = "1600"
LastUpgradeVersion = "1610"
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 = "1600"
LastUpgradeVersion = "1610"
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 = "1600"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit a488fef

Please sign in to comment.