Skip to content

joey-gm/SyntaxTextEditor

Repository files navigation

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:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages