The goal of this project is to build NSTextView replacement component utilizing TextKit2. Because reasons.

The component is developed to serve Swift Studio needs. (ST prefix stands for “Swift sTudio” because SS is not good prefix since 1939)


Swift Package Manager:

dependencies: [
    .package(url: "")


let textView = STTextView()

let paragraph = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
paragraph.lineHeightMultiple = 1.1
paragraph.defaultTabInterval = 28

textView.defaultParagraphStyle = paragraph
textView.font = NSFont.monospacedSystemFont(ofSize: 14, weight: .regular)
textView.textColor = .labelColor
textView.string = try! String(contentsOf: Bundle.main.url(forResource: "content", withExtension: "txt")!)
textView.addAttributes([.foregroundColor:], range: NSRange(location: 10, length: 5))
textView.widthTracksTextView = true
textView.delegate = self

Suggestions or Feedback

I’d love to hear from you! Get in touch via twitter @krzyzanowskim, an issue, or a pull request.


View Github