Delete whitespace in Xcode?

Using Script Debugger's Dictionary Explorer tab, I see this:

So given that, this works:

tell application "Xcode"
	tell text document "TestTarget.swift"
		get contents as text
	end tell
end tell

It may only work for separate windows. That's what I have right now.

@peternlewis As you’ve probably already discovered, my above post doesn’t solve the issue.

If you only have the document opened in one window, you can get to it by getting the front window (which I think is always index 0), using that window’s name and find the textDocument for the file with that name. This is all theory, but it should work.

But if you have it opened in more than one window, or if you have multiple tabs open, or if you’ve split the window… don’t know yet.

If you figure it out, please let me know. I had thought for sure that in AS “front text document” worked, but I was wrong.