Building an IDE for Mac

Hi fellow Mac and iOS developers, I’m researching on how to build a rich IDE such as Xcode or Visual Studio or at least a code editor like TextMate for Mac and so far can’t find any resources or examples. Do you have any recommendations/pointers?

Where do I even start? Can I do it in swift or do I have to get down to low level C++/Obj-C++? What would be a simplest example of rendering an editor view with some Swift code that is highlighted?