mac-cain13 / R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects
MIT License
9.5k stars 764 forks source link

Add conformance to Sendable #906

Closed g-laures closed 1 month ago

g-laures commented 2 months ago

Fix the following issue: https://github.com/mac-cain13/R.swift/issues/902

mac-cain13 commented 1 month ago

Thanks for the PR, we will solve this by updating the code generator to generate slightly different code that makes the Sendable being inferred by the compiler.

letko-dmitry commented 1 month ago

Marking all the types as Sendable, guarded by #if compiler, remains a better solution as it enables wider usage of the types, rather than simply silencing the warnings.

mac-cain13 commented 1 month ago

R.swift 7.6 is now released which makes the R type sendable.

letko-dmitry commented 1 month ago

But, as far as I understand, to use types in modules, it's still necessary to mark them as Sendable explicitly.

letko-dmitry commented 1 month ago

And it applies to all types, including those from RswiftLibrary.

tomlokhorst commented 1 month ago

You are right @letko-dmitry! Thank you for following up on this.

When public structs are generated, it is needed to explicitly conform to Sendable.

(For internal types, the compiler can infer Sendable)