The simple answer is, you can't. Nevertheless.
The only real way is to use the iPhone as a client for a remote desktop to the laptop using something like screens. There's no way to use XCode on an iOS device – there's a lot of speculation and hope Apple will eventually give something, especially with the advent of the new iPad Pro.
Would you really want to code on a iPhone? It would be a terrible and frustrating experience IMO? I could see the case for an iPad with a physical keyboard and a decent amount of screen real estate, but on a phone?