Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Swift 6 feature flags #258

Merged
merged 13 commits into from
Feb 25, 2025
Merged

Enable Swift 6 feature flags #258

merged 13 commits into from
Feb 25, 2025

Conversation

jasikpark
Copy link
Contributor

@jasikpark jasikpark commented Feb 19, 2025

Each feature flag commit links to the associated swift language proposal. Most of them haven't required changes to the source code, other than existential any, as well as region-based isolation popped two new warnings that I'm going to leave for future work to fix.

https://flags.swiftythemes.com/language-features/5.10.html is also a bit of a guide to them.

Example of the warning:

Passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language mode

The warnings are attempting to ensure memory safety when swift is running multi-threaded code.

@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch 3 times, most recently from 97a8fec to c80a7d1 Compare February 19, 2025 21:52
@jasikpark jasikpark changed the base branch from format-swift-code to format-swift-code-with-swift-format February 20, 2025 22:29
@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch 2 times, most recently from 0fb790d to 3593e8b Compare February 20, 2025 22:42
@jasikpark jasikpark force-pushed the format-swift-code-with-swift-format branch from 140fa70 to e87b780 Compare February 20, 2025 22:42
@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch from 3593e8b to a1914aa Compare February 20, 2025 22:56
Base automatically changed from format-swift-code-with-swift-format to main February 21, 2025 15:34
@jasikpark jasikpark marked this pull request as ready for review February 21, 2025 15:37
@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch from a1914aa to 7cd669a Compare February 21, 2025 15:40
@jasikpark jasikpark requested a review from IanVS February 21, 2025 15:42
@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch 2 times, most recently from 7f55ac4 to 4203038 Compare February 21, 2025 21:09
@IanVS
Copy link
Contributor

IanVS commented Feb 24, 2025

Why are there some differences between the targets?

image

@jasikpark jasikpark force-pushed the enable-swift-6-feature-flags branch from 4203038 to a3c598b Compare February 25, 2025 00:22
@jasikpark jasikpark requested a review from IanVS February 25, 2025 00:22
SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES;
SWIFT_UPCOMING_FEATURE_ISOLATED_DEFAULT_VALUES = YES;
SWIFT_UPCOMING_FEATURE_REGION_BASED_ISOLATION = YES;
SWIFT_VERSION = 5.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, how was this empty before? What exactly does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is just enforcing the default as of XCode 16. XCode 16 ships with the Swift 6 compiler, which can run in Swift 4, Swift 5, or Swift 6 compiler modes. So I'm enforcing the default to then upgrade to 6 later.

@@ -563,6 +563,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_UPCOMING_FEATURE_DEPRECATE_APPLICATION_MAIN = YES;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we might get some warnings from libraries that we use, but it should be fine up until swift 6:

Current Swift libraries will continue to build because they compile under pre-Swift 6 language modes. Under such language modes this proposal adds only an unconditional warning when framework-specific entrypoints are used, and provides diagnostics to avoid the warning by automatically migrating user code.


init(messenger: FlutterBinaryMessenger, site: Site) {
init(messenger: any FlutterBinaryMessenger, site: Site) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, was this migration manual or automated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manually clicking "fix" in XCode, not sure how to make it more like eslint . --fix where they're all applied at once

@jasikpark jasikpark merged commit 330c834 into main Feb 25, 2025
4 checks passed
@jasikpark jasikpark deleted the enable-swift-6-feature-flags branch February 25, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants