Skip to content

Make Asset and ImageAsset conform to Sendable#1119

Open
SergeyPetrachkov wants to merge 3 commits intoSwiftGen:developfrom
SergeyPetrachkov:feature/add-sendability-to-generated-assets-types
Open

Make Asset and ImageAsset conform to Sendable#1119
SergeyPetrachkov wants to merge 3 commits intoSwiftGen:developfrom
SergeyPetrachkov:feature/add-sendability-to-generated-assets-types

Conversation

@SergeyPetrachkov
Copy link
Copy Markdown

@SergeyPetrachkov SergeyPetrachkov commented Apr 29, 2024

What's done:

  • added Sendable conformance to ImageAsset and Asset types so the generated code is Swift6- and strict-concurrency-checks- ready. Since all types that are used in the equation are Sendable, and since Sendable is available iOS 8+, macOS 10.10+, watchOS 2.0+ (in other words from the very old versions), it should be safe to just add Sendable conformance to the swift5 stencil without introducing breaking changes. This will allow people to use the generated codes without any unwanted warnings from the compiler.

  • I've started my branch from the develop branch (gitflow)

    • And I've selected develop as the "base" branch for this Pull Request I'm about to create
  • I've added an entry in the CHANGELOG.md file to explain my changes and credit myself
    (or added #trivial to the PR title if I think it doesn't warrant a mention in the CHANGELOG)

    • Add the entry in the appropriate section (Bug Fix / New Feature / Breaking Change / Internal Change)
    • Add a period and 2 spaces at the end of your short entry description
    • Add links to your GitHub profile to credit yourself and to the related PR and issue after your description

{% endmacro %}
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
{{accessModifier}} enum {{enumName}} {
{{accessModifier}} enum {{enumName}}: Sendable {
Copy link
Copy Markdown

@lgrzywac lgrzywac Aug 19, 2024

Choose a reason for hiding this comment

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

I assume the template should be compatible with all Swift5 variants. Therefore I suggest the following:

Suggested change
{{accessModifier}} enum {{enumName}}: Sendable {
#if swift(>=5.7)
{{accessModifier}} enum {{enumName}}: Sendable {
#else
{{accessModifier}} enum {{enumName}} {
#endif

If I'm wrong - just ignore the comment.
If I'm right - please apply the same to struct template below.

The Sendable protocol has been added to Swift 5.7, so it's not available in Swift 5.6 and earlier: SE-0302 Sendable and @Sendable closures

@emadhegab
Copy link
Copy Markdown

what holding this? we are suffering from that cause we have to add it manually everytime , we really need this ASAP

@SergeyPetrachkov
Copy link
Copy Markdown
Author

I don't have writing access to the repo. Someone from the owners should do a review, approve and merge it 🤔

@emadhegab
Copy link
Copy Markdown

I think the owner left the project to no one it didn't got updated for 9 months or more. that's really bad. I would consider going to another things like R.swift or something to get this over with .

@bactn
Copy link
Copy Markdown

bactn commented Jun 13, 2025

Any update this PR?

@jayeshkawli
Copy link
Copy Markdown

Thank you for authoring this. We're also facing the similar issue. We will appreciate if this could get merged that will unblock us from the Swift 6 transition work.

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.

8 participants