Releases: kyle-n/HighlightedTextEditor
Releases · kyle-n/HighlightedTextEditor
Supports languages with two-stage autocorrect in UIKit editor
Some languages use two-stage autocorrect, such as the Chinese Traditional Pinyin keyboard. For the Pinyin keyboard, the user types English characters, which are autocorrected and replaced by Chinese characters.
UITextView uses "marked" text to track these English characters that are to be replaced. This release adds marked text tracking (and Chinese / Japanese keyboard compatibility) to the UIKit editor.
Two-stage autocorrect is already working on the AppKit editor.
UIKit and AppKit editor modifiers
HighlightedTextEditor wraps a UITextView or NSTextView, depending on your platform. 1.4.0 adds modifiers to the HighlightedTextEditor
view to set TextView properties right from SwiftUI.
Modifiers (UIKit)
.autocapitalizationType(_ type: UITextAutocapitalizationType)
.autocorrectionType(_ type: UITextAutocorrectionType)
.backgroundColor(_ color: UIColor)
.defaultColor(_ color: UIColor)
.defaultFont(_ font: UIFont)
.keyboardType(_ type: UIKeyboardType)
.insertionPointColor(_ color: UIColor)
.multilineTextAlignment(_ alignment: TextAlignment)
Modifiers (AppKit)
.allowsDocumentBackgroundColorChange(_ allowsChange: Bool)
.backgroundColor(_ color: NSColor)
.defaultColor(_ color: NSColor)
.defaultFont(_ font: NSFont)
.drawsBackground(_ shouldDraw: Bool)
.insertionPointColor(_ color: NSColor)
.multilineTextAlignment(_ alignment: TextAlignment)
The properties dynamically update based on your SwiftUI state.