-
Notifications
You must be signed in to change notification settings - Fork 34
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
Create non-@MainActor-bound methods for rounding to pixel at scale #140
Conversation
@@ -27,7 +27,7 @@ public protocol ScaleFactorProviding { | |||
extension UIScreen: ScaleFactorProviding { | |||
|
|||
public var pixelsPerPoint: CGFloat { | |||
return scale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some stylizing in this file while I was here 😅
35ddc34
to
1d74c6b
Compare
A (much more breaking) alternative that might be worth considering here is removing pixel rounding from aspectRatio.size(forWidth: ...).ceiledToPixel() or aspectRatio.size(forWidth: ...).flooredToPixel() Not tonight though. Let's open an issue for this. |
1d74c6b
to
5446950
Compare
extension Int: ScaleFactorProviding { | ||
|
||
public var pixelsPerPoint: CGFloat { | ||
return CGFloat(self) | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
big ol' breaking change. but... I doubt this is used much.
5446950
to
0267011
Compare
In #132 we made it difficult to work with aspect ratios when the scale factor is known a-priori and does not need to be derived on the main actor. Here we make it easy again through the magic of copy and paste.