Okay, das war einfacher als ich dachte. Ich näherte mich von einem anderen (wenn auch fast korrekten) Weg.
class func currentEditorView() -> (NSURL?, NSView?) {
let currentWindowController = NSApp.keyWindow?.windowController
guard currentWindowController!.className == "IDEWorkspaceWindowController" else { return (nil, nil) }
let filename = currentWindowController!.valueForKey("editorArea")!.valueForKey("lastActiveEditorContext")!.valueForKey("originalRequestedDocumentURL")
let editor = currentWindowController!.valueForKey("editorArea")!.valueForKey("lastActiveEditorContext")!.valueForKey("editor")!.valueForKey("textView")
return (filename as? NSURL, editor as? NSView)
}
Das gibt mir sowohl die Dateinamen als NSURL sowie die DVTSourceTextView als NSView ohne die Notwendigkeit der privaten Header inklusive. Spiffy.
Jetzt kenne ich nicht nur den Namen der Datei, die ich gerade bearbeite, sondern auch, ob es sich um eine schnelle, objc, c oder C++ Datei handelt! Das ist Coolness!
Natürlich ist dies bei Xcode 8 alles andere als strittig. –