Skip to content

Commit

Permalink
Merge pull request #275 from hyun99999/master
Browse files Browse the repository at this point in the history
Replace `UIScreen.main` to get display scale on iOS 13.0 and later
  • Loading branch information
lucdion authored Nov 3, 2023
2 parents c71a27b + d103ba2 commit a0ab0f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Impl/Coordinates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ final class Coordinates<PinView: Layoutable> {

private func getDisplayScale() -> CGFloat {
#if os(iOS) || os(tvOS)
if #available(iOS 13.0, tvOS 13.0, *) {
return UITraitCollection.current.displayScale
} else {
return UIScreen.main.scale
}
#elseif os(OSX)
#if swift(>=4.1)
return NSScreen.main?.backingScaleFactor ?? 2.0
Expand Down

0 comments on commit a0ab0f5

Please sign in to comment.