-1

I am creating an application which besides everything else must display Swift (and ObjectiveC) source code, with code highlighting, inspections, compiler warning and errors.

Is there a way to reuse the XCode functionality which does that? Any internal APIs which are stable enough?

Note that since XCode v8 there are no XCode plugins according to WWDC 2016.

NSNoob
  • 5,548
  • 6
  • 41
  • 54
voddan
  • 31,956
  • 8
  • 77
  • 87
  • So you want to embed a fully featured IDE and Swift / Objective-C compiler in an application? That won't work. You can try any syntax highlighting libraries and use a server to compile the code for compilation errors, that could work. – redent84 Sep 26 '16 at 14:36
  • 2
    Unfortunately, what you want doesn't exist -- there are no system APIs (private or otherwise) that will let you embed Xcode functionality the way that you want. However, you can take a look at tools like [SourceKitten](https://github.com/jpsim/SourceKitten) (a wrapper around the [SourceKit](https://github.com/apple/swift/tree/master/tools/SourceKit) service that does the syntax highlighting and semantic parsing for Xcode) to replicate some of that yourself. – Itai Ferber Sep 26 '16 at 14:40
  • Thanks @ItaiFerber! If you rewrite your comment as an answer, I'll gladly accept it. – voddan Sep 26 '16 at 14:54

1 Answers1

2

Unfortunately, what you want doesn't exist — there are no system APIs (private or otherwise) that will let you embed Xcode functionality in the way that you want. However, you can take a look at tools like SourceKitten (a wrapper around the SourceKit service that does the syntax highlighting and semantic parsing for Xcode) to replicate some of that yourself.

Depending on what you're looking for and the type of IDE that you want to implement, there are embeddable versions of other editors (say, vim, via the embeddable frameworks that projects like vimr provide) which can provide syntax highlighting and some compilation, but then you're coupling yourself to those editors, how they work, and the features they provide.

Itai Ferber
  • 28,308
  • 5
  • 77
  • 83