Introduction to STTextView
STTextView is a high-performance text editor designed for both macOS and iOS platforms, developed as a reimplementation of Apple's standard NSTextView
and UITextView
. This project aims to provide a more robust and feature-rich text editing experience by utilizing the advanced capabilities of TextKit 2, Apple's framework for text layout and processing, which was introduced as a successor to TextKit 1 during WWDC 2021.
Background and Purpose
The primary motivation behind STTextView's development was to address the functional limitations and bugs present in NSTextView
and TextKit 2 as of early 2022. The original Apple text components were not fully operational, leading the developer to start this project to cater specifically to the needs of Swift Studio as a versatile source code editor.
Key Features of STTextView
STTextView boasts a rich set of features that enhance text editing capabilities beyond the default system offerings:
- macOS Integration: Seamless integration with the macOS text system.
- Performance and Editing: Improved text editing performance with advanced features.
- Line Numbering: Displays line numbers within the text view.
- Visibility Features: Supports the display of invisible characters.
- Customization: Offers customization options for colors and fonts.
- Line Wrapping: Allows toggling of line wrapping and adjustment of line height.
- Text Highlighting and Selection: Facilitates highlighting text and selecting ranges.
- Multi-Cursor Editing: Enables editing with multiple cursors.
- Search and Replace: Built-in capabilities for text search and replacement.
- Spelling and Grammar: Integrated spelling and grammar checking.
- Dictation Support: Offers dictation features for voice input.
- Completion Features: Customizable support for text completion.
- Smooth Scrolling: Ensures smooth scrolling through long documents.
- Bidirectional Text Support: Supports both Left-To-Right (LTR) and Right-To-Left (RTL) text layouts.
- Undo/Redo Functionality: Implements easy undo and redo actions.
- Plugins: Expandable with plugins for additional features like syntax highlighting and annotations.
Getting Started and Usage
STTextView is available via the Swift Package Manager, making it easy to integrate into any project by adding the repository as a dependency. Developers can create text views using STTextView in both macOS and SwiftUI environments, enabling advanced capabilities like rich text editing and custom views.
Plugin Support and Integration
Plugins significantly enhance the functionality of STTextView, providing additional features such as:
- Syntax Highlighting: Using the Plugin-Neon with TreeSitter for source code highlighting.
- Typing Completions: The Plugin-TextFormation adds typing suggestions.
- Annotations: Plugin-Annotations supports inline error messages and comments.
These plugins enhance STTextView's utility, allowing developers to tailor the editor to specific needs while maintaining a modular and adaptable software structure.
Support and Development
The ongoing development and sustainability of STTextView are supported by contributions from GitHub sponsors. Users are invited to engage with the community through discussions and to suggest or vote on new features for future enhancements.
Licensing
STTextView is available for open-source projects under the GNU GPL license v3. For commercial use, licenses start from €5, allowing developers to keep their application's source code proprietary while using STTextView.
Conclusion
STTextView represents a comprehensive and customizable text editing component ideal for developers looking for a flexible and performance-oriented replacement for Apple's native text view components. Its robust feature set, combined with community and commercial support, makes it a valuable tool for text editing and code development environments.