Question: how to connect iphone with xcode?
Answer: Open Xcode and go to Window > Devices and Simulators.
Plug your iOS device into your Mac using a lightning cable. You may need to select to Trust This Computer on your device.
Select your device and then select the Connect via network checkbox to pair your device: