I am afraid that this is not yet possible. As if you see the documentation here
https://developer.apple.com/reference/xcodekit
The Framework really has a few classes that none of them points to several files ... As you can see, you can edit the text from the buffer from the current open tab in Xcode, which makes it a little more complicated. The buffer can be used only in the context of the file (imagine that hell contains 10,000,000 lines of code loading into the buffer and manipulates such text). I believe that in the future apples will expand this to the maximum, but for now, we should be satisfied that we ... Sorry for the disappointing news.
source share