The only way I have found to know if it is an iphone or an ipad and use logics depending on the device is this:
UIDevice.current.userInterfaceIdiom == .pad
Any other second the iphone can give missing information.