Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 1.02 KB

README.md

File metadata and controls

24 lines (17 loc) · 1.02 KB

Syntax Text Editor

Swift syntax highlighting model based on TextKit/NSTextStorage.

Compatible with macOS and iOS (Cocoa, UIKit and SwiftUI).

screenshot

Syntax Model:

  • Lexer (protocol) converts coding language keywords/regex into Syntax Patterns (struct) - a combination of patterns matching substring/regex, syntax type, and style in form of [NSAttributedString.Key], which will be used to generate matching tokens ( NSAttributedString.Key + NSRange ) for NSTextStorage to process
  • Color, font and line spacing are customizable via Syntax Theme
  • Supports Swift syntax (SwiftLexer). Can be extended for other programming languages

Syntax Views:

  • SyntaxViewController for Cocoa and UIKit
  • SyntaxUIViewRepresentable for SwiftUI (iOS)
  • SyntaxNSViewRepresentable for SwiftUI (macOS)

Examples:

  • Document based text editor for macOS / iOS across Cocoa, UIKit and SwiftUI.

Credits: