Skip to content

Commit

Permalink
Use UITraitCollection to access display scale
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun99999 committed Nov 1, 2023
1 parent b2ff6d5 commit d103ba2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/Impl/Coordinates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ final class Coordinates<PinView: Layoutable> {
private func getDisplayScale() -> CGFloat {
#if os(iOS) || os(tvOS)
if #available(iOS 13.0, tvOS 13.0, *) {
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
return windowScene?.screen.scale ?? 1.0
return UITraitCollection.current.displayScale
} else {
return UIScreen.main.scale
}
Expand Down

0 comments on commit d103ba2

Please sign in to comment.