Skip to content

[Swift] Migrate to swift 6.0 and Implements support gRPC v2#8983

Merged
mustiikhalil merged 2 commits into
google:masterfrom
mustiikhalil:mmk/grpc-swift-2
May 6, 2026
Merged

[Swift] Migrate to swift 6.0 and Implements support gRPC v2#8983
mustiikhalil merged 2 commits into
google:masterfrom
mustiikhalil:mmk/grpc-swift-2

Conversation

@mustiikhalil
Copy link
Copy Markdown
Collaborator

@mustiikhalil mustiikhalil commented Mar 18, 2026

The following PR migrate the support for the swift library to swift 6.0, since that's the minimum version we can use for swift gRPC 2.0 which uses async/await under the hood. It would also enable us to migrate away from XCTests into swift testing in a future PR.

@github-actions github-actions Bot added python c++ grpc codegen Involving generating code from schema swift labels Mar 18, 2026
@github-actions github-actions Bot added the CI Continuous Integration label Mar 18, 2026
@mustiikhalil mustiikhalil changed the title [Swift] Implements code generation to support gRPC v2 [Swift] Migrate to swift 6.0 and Implements support gRPC v2 Mar 18, 2026
@mustiikhalil mustiikhalil force-pushed the mmk/grpc-swift-2 branch 2 times, most recently from ede0775 to 39fccbf Compare March 25, 2026 21:05
@mustiikhalil mustiikhalil marked this pull request as ready for review March 25, 2026 21:06
@mustiikhalil mustiikhalil self-assigned this Mar 25, 2026
@mustiikhalil mustiikhalil requested a review from jtdavis777 March 25, 2026 21:08
Comment thread grpc/src/compiler/swift_generator.cc
@jtdavis777
Copy link
Copy Markdown
Collaborator

Is there much/any danger of causing compatibility breaks with this change? Will swift users be forced to update?

@mustiikhalil
Copy link
Copy Markdown
Collaborator Author

mustiikhalil commented Mar 25, 2026

Is there much/any danger of causing compatibility breaks with this change? Will swift users be forced to update?

Yes, users will be forced to update to swift 6.0. However that would only be for upcoming flatbuffers releases, and flatbuffers swift has been stable for a while now.

Usually I follow the swift-protobuf repository when it comes to supported swift versions. Currently the minimum there is swift 6.0 and it's been that for a while. Yesterday Apple released swift 6.3, and 6.4 should be released by the end of the year.

@mustiikhalil
Copy link
Copy Markdown
Collaborator Author

@hassila if you got time, a second eye on the swift code would be nice! I did force @unchecked sendable for now. but we can revisit that after the PR is merged and after understanding how flatbuffers would work with concurrency

Copy link
Copy Markdown
Contributor

@blindspotbounty blindspotbounty left a comment

Choose a reason for hiding this comment

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

I looked only at flatbuffers which looks good to me.
Unfortunately, I don't know much of grpc specifics..

Comment thread swift/Sources/FlatBuffers/ByteBuffer.swift
Comment thread tests/swift/fuzzer/CodeGenerationTests/test_import_generated.swift Outdated
Comment thread tests/swift/Tests/Flatbuffers/ByteBufferTests.swift Outdated
Copy link
Copy Markdown
Collaborator

@jtdavis777 jtdavis777 left a comment

Choose a reason for hiding this comment

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

The generator code looks alright when compared to the previous structure of this file -- there are some things to be improved (see the comments) but want your take on if you want to take on such a project at this time. I'd rather see the new feature than gate this on trying to improve it.

Let's have some discussion on my comments about it then I will approve

Comment thread grpc/src/compiler/swift_generator.cc Outdated
Comment thread grpc/src/compiler/swift_generator.cc Outdated
Comment thread grpc/src/compiler/swift_generator.cc Outdated
Comment thread grpc/src/compiler/swift_generator.cc Outdated
The following migrates to swift 6.0, and also
migrate to swift-grpc 2.0 that uses swift-nio
under the hood to provide nicer API and async await

Adds sendable to enum & update @_implementationOnly imports to use internal imports
@jtdavis777
Copy link
Copy Markdown
Collaborator

@mustiikhalil looks like you have one unresolved comment - feel free to resolve and merge when ready!

@mustiikhalil mustiikhalil merged commit e6bbb3d into google:master May 6, 2026
51 checks passed
@mustiikhalil mustiikhalil deleted the mmk/grpc-swift-2 branch May 6, 2026 02:39
@mustiikhalil
Copy link
Copy Markdown
Collaborator Author

@jtdavis777 thanks for the review again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ CI Continuous Integration codegen Involving generating code from schema grpc python swift

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants