If you see the following lines:
https://github.com/dennisweissmann/DeviceKit/blob/master/Source/Device.generated.swift#L584
https://github.com/dennisweissmann/DeviceKit/blob/master/Source/Device.generated.swift#L591
/// Returns whether the device is an iPhone (real or simulator)
public var isPhone: Bool {
return (isOneOf(Device.allPhones)
|| isOneOf(Device.allSimulatorPhones)
|| UIDevice.current.userInterfaceIdiom == .phone) && !isPod
}
/// Returns whether the device is an iPad (real or simulator)
public var isPad: Bool {
return isOneOf(Device.allPads)
|| isOneOf(Device.allSimulatorPads)
|| UIDevice.current.userInterfaceIdiom == .pad
}
UIDevice.current is used.
Imagine this example; I'm running on an iPhone X. I'm getting an instance of .iPad6 and checking for .isPhone on that instance. From my understanding, it would return true since (UIDevice.current.userInterfaceIdiom == .phone) == true.
Do note that I haven't tested this.
@dennisweissmann mentioning you since you like that so much 😉 and because I can't assign you.
If you see the following lines:
https://github.com/dennisweissmann/DeviceKit/blob/master/Source/Device.generated.swift#L584
https://github.com/dennisweissmann/DeviceKit/blob/master/Source/Device.generated.swift#L591
UIDevice.currentis used.Imagine this example; I'm running on an iPhone X. I'm getting an instance of
.iPad6and checking for.isPhoneon that instance. From my understanding, it would returntruesince(UIDevice.current.userInterfaceIdiom == .phone) == true.Do note that I haven't tested this.
@dennisweissmann mentioning you since you like that so much 😉 and because I can't assign you.