In my application, I was implemented pull-to-refresh feature and custom loading icon. In IPhone which has dynamic island, It was overlapsed my loading icon.
I want to detect device which has dynamic island or not. If it has, I will add some top space to it.
CodePudding user response:
Currently, as far as I know, dynamic island is will included in ActivityKit
on late of 2022. You can check from this link for ActivityKit and Apple's thread about it
But there is a workaround for you to get the thing you want. Currently dynamic island only available on iPhone 14 Pro
and iPhone 14 Pro Max
. So just need to check this both device
Code will be like this
extension UIDevice {
func checkIfHasDynamicIsland() -> Bool {
return self.name == "iPhone 14 Pro" || self.name == "iPhone 14 Pro Max" ? true : false
}
}
Usage
let value = UIDevice().checkIfHasDynamicIsland()
print("value: ", value)