I want to connect my electric guitar to my application. I have hardware (Line6 Sonic Port) that transfers audio from my guitar to my iPhone. I figured out how to listen to the sound in the headphones, but the sound comes from the headphone microphone, not the Lightning Port. How to programmatically find the audio input of a Lightning Port instead of receiving sound through a headphone microphone?
Here is what I have tried so far:
self.audioEngine = AVAudioEngine() let input = self.audioEngine.inputNode let mixer = self.audioEngine.mainMixerNode let output = self.audioEngine.outputNode self.audioEngine.inputNode.installTapOnBus(0, bufferSize: 128, format: input.inputFormatForBus(0)) { (buffer, time) -> Void in
When I launch this, I hear a sound, but it comes from my headphone microphone, not the guitar. How to connect to the audio coming from the lightning port?
For a quick illustration, the hardware I use here is used: 
source share