-
Notifications
You must be signed in to change notification settings - Fork 316
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
Improve Swift Concurrency support #1041
Comments
From the post:
Well that's kind of the case right now with these warnings. I worked on this for a while yesterday, and it's kinda of a pain to do right in a codebase that only partially supports Swift concurrency. A bunch of types in the standard library (Foundation, UIKit, etc) added
The second option leads to my biggest pet-peeve of async/await: an explosion of everything needing to be async. FRP doesn't suffer from this as much. In our case not only does that require making lots of code asynchronous, but it's also impossible because we need to support pre-iOS 13.0.
Unfortunately
There's also problems with the need for APIs to have There's a few improvements that I'll put in a PR in a bit, but for the most part unfortunately there isn't much that we can do for the time being. |
🤕 Xcode 14 will be a fun release. Thanks for taking a look at this! |
Won't fix until Swift 5.6 |
I am still facing this type of error |
@pro-akbar Hey! Would you be able to create a new issue and fill out all of your environment information in there? 😊 It's a bit easier to have a conversation in a new issue and reference this one. Thank you thank you! ❤️ |
I think it's a good moment for this SDK to start preparing for Swift 6 and adopt Sendable where possible. It should be doable to add Sendable inheritance for some types. I've currently got these warnings: |
@AvdLee thanks for bringing this up! We tried it out a while back but had some issues that we would hoping would go away in newer Xcode betas. We'll give it another shot. |
Not relevant to this issue but just wanted to say... Hi @AvdLee! 👋 |
Fixes [CSDK-379] and #1041 (comment) [CSDK-379]: https://revenuecats.atlassian.net/browse/CSDK-379?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ### Main changes: - `Sendable` conformances to all types that are thread-safe - `@unchecked Sendable` for types that the compiler can't enforce, but with documentation as to why - Made classes that aren't mocked `final` (note that this doesn't change the API, because none of these were `open` to begin with) - Made some classes thread-safe that weren't (like `DeviceCache`) For the non-`final` `class`es, I've actually managed to compile the SDK with all of them as `final` and `Sendable`, to make sure that making them `@unchecked Sendable` didn't hide any other issues. ### Future improvements: - https://twitter.com/nachosoto/status/1557139992056500224?s=21&t=arWdvEzTIFANBvwqQ0vPiA - https://twitter.com/nachosoto/status/1557141944777592832?s=21&t=arWdvEzTIFANBvwqQ0vPiA - https://twitter.com/nachosoto/status/1557143374922059776?s=21&t=arWdvEzTIFANBvwqQ0vPiA ### Depends on: - #1794 - #1804 - #1806 - #1807 - #1808 - #1813 - #1822 - #1823 - #1824 - #1825 - #1826
Should we close this? :) |
I think we're all done with this one! Closing |
Changes will be released in the next version, next Wednesday or sooner |
Thanks a lot for the hard work on this @NachoSoto! And Hi back to you @joshdholtz ⛳️ |
Wow... always rubbing in that you won that round of golf, aren't you? 😛 |
Of course, I need to create extra reason to meet up again for another round of golf 🤪 |
We're using Swift Concurrency in a few places.
There are a couple of compiler flags that help prevent issues with Swift Concurrency, that we should leverage.
The flags are
-Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks
And can be enabled in Xcode -> RevenueCat Project -> RevenueCat target -> Build Settings -> Other Swift Flags.
Enabling them fires up a few warnings and errors.
We should enable the compiler flags, and fix the warnings / errors.
More context here: https://forums.swift.org/t/concurrency-in-swift-5-and-6/49337
https://app.shortcut.com/revenuecat/story/11686/enable-swift-compiler-flags-for-concurrency-and-fix-errors
The text was updated successfully, but these errors were encountered: