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

Replace UIScreen.main to get display scale on iOS 13.0 and later (#2215) #2216

Merged
merged 14 commits into from
Nov 2, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/Public/iOS/LottieAnimationViewBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ open class LottieAnimationViewBase: UIView {

var screenScale: CGFloat {
#if os(iOS) || os(tvOS)
UIScreen.main.scale
if #available(iOS 13.0, tvOS 13.0, *) {
return window?.windowScene?.screen.scale ?? 1.0
} else {
return UIScreen.main.scale
}
#else // if os(visionOS)
// We intentionally don't check `#if os(visionOS)`, because that emits
// a warning when building on Xcode 14 and earlier.
Expand Down
Loading