Well, considering Macs now run M1 chips and some iPhone and iPad apps can run on the new Macs, it shouldn't (or rather, better not) be long before XCode runs on iPads. There are already some IDEs that run on iPad, though not fully functional and can only run certain code.
In situations like XCode, apps like those should only run on Desktop mode, and then use the iPhone screen as a test run. If you exit Desktop mode, then the iPhone should switch to running the test app only, and not allow the user to open the code unless docked. Though an annoying limitation, it's unlikely developers would type code using their thumbs anyway.
I think we should be able to write code for Apple's rumored Glass already. I wrote an article a while back on how Apple's AR Glasses could benefit the blind and visually impaired, if you want to check it out.