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

Fix @MainActor reference in unsupported OS versions #4612

Draft
wants to merge 1 commit into
base: release/4.43.3
Choose a base branch
from

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Dec 19, 2024

#1826 introduced references to @MainActor that are utilized in OS versions that don't support Swift Concurrency - namely, iOS 11-12 and macOS 10.12-10.14.

This PR addresses it by using a compilation flag.

@aboedo aboedo requested review from MarkVillacampa, fire-at-will and a team December 19, 2024 21:02
@aboedo aboedo self-assigned this Dec 19, 2024
@RevenueCat-Danger-Bot
Copy link

1 Error
🚫 Label the PR using one of the change type labels. If you are not sure which label to use, choose pr:other.
Label Description
pr:feat A new feature. Use along with pr:breaking to force a major release.
pr:fix A bug fix. Use along with pr:force_minor to force a minor release.
pr:other Other changes. Catch-all for anything that doesn't fit the above categories. Releases that only contain this label will not be released. Use along with pr:force_patch, or pr:force_minor to force a patch or minor release.
pr:RevenueCatUI Use along any other tag to mark a PR that only contains RevenueCatUI changes
pr:next_release Preparing a new release
pr:dependencies Updating a dependency
pr:phc_dependencies Updating purchases-hybrid-common dependency

Generated by 🚫 Danger

@aboedo aboedo added the pr:fix A bug fix label Dec 19, 2024
@@ -33,11 +33,18 @@ public typealias PurchaseResultData = (transaction: StoreTransaction?,
/**
Completion block for ``Purchases/purchase(product:completion:)``
*/
#if swift(>=5.5) && canImport(_Concurrency)
Copy link
Member Author

@aboedo aboedo Dec 19, 2024

Choose a reason for hiding this comment

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

I believe the swift concurrency import check would work

Copy link
Member

Choose a reason for hiding this comment

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

I think since this is a compiler conditional, canImport only checks if the version of Xcode you're compiling with supports concurrency.

And since @MainActor is supposedly back ported to macOS 10/11, and the current version of Xcode supports concurrency, this means we would end up always compiling the first branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants