GitXplorerGitXplorer
j

SyntaxTextEditor

public
5 stars
1 forks
1 issues

Commits

List of commits on branch master.
Unverified
477f4289a8db14cb9ca6a8b2e5816b1f3bbe305b

Syntax Text Editor

jjoey-gm committed 5 years ago
Unverified
febe8223eecec27961d3bfee1b8051920248f542

Initial Commit

jjoey-gm committed 5 years ago

README

The README file for this repository.

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: