You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I tried the screenRatio returns the device/simulator logical size. I am wondering is there a way to get the physical size or scale factor of the device/simulator?
The text was updated successfully, but these errors were encountered:
@alamyudi Currently, there is no way in DeviceKit to get the physical size of the device/screen. This could be a really nice addition to the library. Will look into it when I have time.
static var screenSize: (width: Measurement<UnitLength>, height: Measurement<UnitLength>) {
let ppi = Device.current.ppi!
var width = UIScreen.main.nativeBounds.width / Double(ppi)
var height = UIScreen.main.nativeBounds.height / Double(ppi)
if UIApplication.shared.interfaceOrientation?.isLandscape == true {
// Swap the values, as `nativeBounds` does not change with the screen rotation
swap(&width, &height)
}
return (
width: Measurement(value: width, unit: .inches),
height: Measurement(value: height, unit: .inches)
)
}
Hi, very amazing library!
As far as I tried the
screenRatio
returns the device/simulator logical size. I am wondering is there a way to get the physical size or scale factor of the device/simulator?The text was updated successfully, but these errors were encountered: