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

Make it possible to do rounding calculations off of @MainActor when scale is known #138

Closed
wants to merge 1 commit into from

Conversation

dfed
Copy link
Collaborator

@dfed dfed commented Sep 3, 2024

#132 left us in a place where we cannot do pixel rounding at constant scales when off of @MainActor. I expected this would be fine, but upon an attempt to adopt of latest master I've realized that nonisolated delegate methods can be hampered by this approach.

This PR introduces the concept of CGFloatProviding, to which CGFloat and Int both conform. Both of these types no longer conform to ScaleFactorProviding, and for every method that takes a scaleFactor: ScaleFactorProviding I have created a duplicate, non-@MainActor-bound method that takes a scale: CGFloatProviding and made the scaleFactor-taking method call through to this new scale-taking method.

This PR creates a good amount of duplicated API surface – I'm not convinced this is the best possible approach. Very open to feedback, but I do think we'll want to solve this problem before creating the next release.

@dfed dfed self-assigned this Sep 3, 2024
@dfed dfed force-pushed the dfed--scale-factor-off-main branch from e44aa9c to 649562d Compare September 3, 2024 17:08
@dfed dfed requested a review from NickEntin September 3, 2024 17:10
@dfed dfed marked this pull request as ready for review September 3, 2024 17:10
@dfed
Copy link
Collaborator Author

dfed commented Oct 30, 2024

Closing in favor of #140

@dfed dfed closed this Oct 30, 2024
@dfed dfed deleted the dfed--scale-factor-off-main branch October 30, 2024 19:43
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.

1 participant