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

feat: make the Theme type support sendablity #351

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

MojtabaHs
Copy link
Contributor

@MojtabaHs MojtabaHs commented Oct 14, 2024

The type must be sendable or it will be an error in Swift 6

@MojtabaHs
Copy link
Contributor Author

A simple sample code for test in Swift 6:

extension Theme {
    static let myTheme = Theme()
}

@gonzalezreal
Copy link
Owner

Hi,
Thanks for looking into this!

I think there is more to it than making Theme conform to Sendable. When you create a Package@swift-6.0.swift with // swift-tools-version:6.0 you will see a few more issues.

I already went through this process for gonzalezreal/NetworkImage. See gonzalezreal/NetworkImage#34.

I didn't have time to do the same with MarkdownUI. You are welcome to give it a try. There is an attempt in #349.

@MojtabaHs
Copy link
Contributor Author

MojtabaHs commented Oct 15, 2024

I reviewed that PR already, but it seems too-much-changed to review and merge all at once. I needed this functionality in my project, and it worked with just this one simple change. There’s no need to mark everything as Sendable or raise the minimum Swift version in my case.

In my opinion, we should migrate step by step.
Let me know your opinion. thanks

@gonzalezreal
Copy link
Owner

Sure! I agree. I was misled by the PR title. My understanding is that this PR is about making Theme conform to Sendable, not compatible with Swift 6. Making it compatible with Swift 6 can require more work.

@MojtabaHs
Copy link
Contributor Author

MojtabaHs commented Oct 15, 2024

Absolutely! With this change, you'll be able to use the Theme type in code with stricter concurrency checks, including Swift6-only codebases. However, not all features of the framework will be fully compatible yet. More work is needed for full compatibility, just as you mentioned.

@MojtabaHs MojtabaHs changed the title feat: make the Theme type support Swift 6 feat: make the Theme type support sendablity Oct 15, 2024
@gonzalezreal gonzalezreal merged commit a9c7615 into gonzalezreal:main Oct 15, 2024
1 check passed
@MojtabaHs
Copy link
Contributor Author

Thanks for merging, please don't forget to tag and release this (maybe 2.4.2) so that I can continue using this fantastic library directly.

Thanks again 🙌🏻

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