Skip to content

Commit 21c44db

Browse files
committed
Use UIApplication instead of UIScreen.main on iOS 13.0 and later
1 parent c71a27b commit 21c44db

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Impl/Coordinates.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ final class Coordinates<PinView: Layoutable> {
108108

109109
private func getDisplayScale() -> CGFloat {
110110
#if os(iOS) || os(tvOS)
111+
if #available(iOS 13.0, *) {
112+
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
113+
return windowScene?.screen.scale ?? .zero
114+
} else {
111115
return UIScreen.main.scale
116+
}
112117
#elseif os(OSX)
113118
#if swift(>=4.1)
114119
return NSScreen.main?.backingScaleFactor ?? 2.0

0 commit comments

Comments
 (0)