How krzyzanowskim/sttextview works
STTextView is a reusable TextKit 2 editor for macOS and iOS, with SwiftUI wrappers and a demo app. The main workflow is an app or SwiftUI binding supplying editable text and options to the platform editor, which manages text content/layout and presents editing, selection, gutter, and optional completion/plugin capabilities. Shared text-system components underpin separate AppKit and UIKit implementations. Some feature links are documented in the README; unsampled implementation details are not inferred beyond those documented capabilities.
Main entry points: STTextViewAppKit/STTextView.swift AppKit editor · STTextViewUIKit/STTextView.swift UIKit editor · TextView.swift SwiftUI iOS wrapper · STTextLayoutManager.swift Text layout manager
Components 22
App Interfaces
- SwiftUI macOS wrapper
Sources/STTextViewSwiftUIAppKit/TextView.swift - SwiftUI iOS wrapper
Sources/STTextViewSwiftUIUIKit/TextView.swift - View options
Sources/STTextViewSwiftUICommon/TextViewOptions.swift
Platform Editors
- AppKit editor
Sources/STTextViewAppKit/STTextView.swift - UIKit editor
Sources/STTextViewUIKit/STTextView.swift
Text System
- Shared editor contract
Sources/STTextViewCommon/STTextViewProtocol.swift - Text content storage
Sources/STTextViewCommon/STTextContentStorage.swift - Attributed text element
Sources/STTextViewCommon/STAttributedTextElement.swift - Text layout manager
Sources/STTextViewCommon/STTextLayoutManager.swift - AppKit fragment rendering
Sources/STTextViewAppKit/STTextLayoutFragment.swift - UIKit fragment rendering
Sources/STTextViewUIKit/STTextLayoutFragment.swift
Editor Capabilities
- AppKit gutter
Sources/STTextViewAppKit/Gutter/STGutterView.swift - UIKit gutter
Sources/STTextViewUIKit/Gutter/STGutterView.swift - Completion controller
Sources/STTextViewAppKit/STCompletion/STCompletionViewController.swift - Completion window
Sources/STTextViewAppKit/STCompletion/Window/STCompletionWindowController.swift - Plugin integration
Sources/STTextViewAppKit/Plugin/STPluginContext.swift - Editing services
Sources/STTextViewAppKit/STTextView+Find.swift - Undo management
Sources/STTextViewCommon/CoalescingUndoManager.swift
Demo Applications
- macOS editor demo
TextEdit/Mac/PrimaryTextEditViewController.swift - SwiftUI editor demo
TextEdit.SwiftUI/ContentView.swift
Other components
- App developer
- SwiftUI app
Connections 26
- App developer → AppKit editor: configures
- SwiftUI app → SwiftUI macOS wrapper: binds text
- SwiftUI app → SwiftUI iOS wrapper: binds text
- SwiftUI macOS wrapper → AppKit editor: wraps
Sources/STTextViewSwiftUIAppKit/TextView.swift - SwiftUI iOS wrapper → UIKit editor: creates and updates
Sources/STTextViewSwiftUIUIKit/TextView.swift - SwiftUI macOS wrapper → View options: uses options
Sources/STTextViewSwiftUIAppKit/TextView.swift - SwiftUI iOS wrapper → View options: uses options
Sources/STTextViewSwiftUIUIKit/TextView.swift - AppKit editor → Shared editor contract: implements
- UIKit editor → Shared editor contract: implements
- AppKit editor → Text content storage: manages text
- UIKit editor → Text content storage: manages text
- Text content storage → Attributed text element: replaces from
Sources/STTextViewCommon/STTextContentStorage.swift - AppKit editor → Text layout manager: uses for layout
- UIKit editor → Text layout manager: uses for layout
- Text layout manager → AppKit fragment rendering: renders fragments
- Text layout manager → UIKit fragment rendering: renders fragments
- AppKit editor → AppKit gutter: offers line numbers
- UIKit editor → UIKit gutter: offers line numbers
- AppKit editor → Completion controller: offers completion
- Completion controller → Completion window: hosts in window
Sources/STTextViewAppKit/STCompletion/Window/STCompletionWindowController.swift - AppKit editor → Plugin integration: supports plugins
- AppKit editor → Editing services: provides find and replace
- AppKit editor → Undo management: supports undo
- macOS editor demo → AppKit editor: creates
TextEdit/Mac/PrimaryTextEditViewController.swift - macOS editor demo → Completion controller: supplies completions
TextEdit/Mac/PrimaryTextEditViewController.swift - SwiftUI editor demo → SwiftUI iOS wrapper: presents
TextEdit.SwiftUI/ContentView.swift