I need to check if my iPhone has a headphone port or not. I checked if the headphone is connected using the following code
!AVAudioSession.sharedInstance().currentRoute.outputs.filter { $0.portType == AVAudioSession.Port.headphones }.isEmpty
But it shows me that headphone is connected or not. But iPhoneX does not have any earphone port.
Is there any way to differentiate between "headphone not available" and "headphone not connected"?
Any help will be appreciated.