STTextKitPlus
Collection of useful TextKit 2 helpers
Install / Use
/learn @krzyzanowskim/STTextKitPlusREADME
Collection of useful TextKit 2 helpers.
Collection of TextKit 2 helpers used to build STTextView.
Usage
NSRange Additions
NSRange.notFound
NSRange.isEmpty
NSRange.nsValue
NSRange(_ textRange: NSTextRange, in textContentManager: NSTextContentManager)
NSRange(_ textLocation: NSTextLocation, in textContentManager: NSTextContentManager)
NSTextRange Additions
NSTextRange(_ nsRange: NSRange, in textContentManager: NSTextContentManager)
func length(in textContentManager: NSTextContentManager) -> Int
func clamped(to textRange: NSTextRange) -> NSTextRange?
NSTextContentManager Additions
func location(at offset: Int) -> NSTextLocation?
func location(line lineIdx: Int, character characterIdx: Int? = 0) -> NSTextLocation?
func position(_ location: NSTextLocation) -> (row: Int, column: Int)?
func attributedString(in range: NSTextRange?) -> NSAttributedString?
NSTextLayoutManager Additions
func textLineFragment(at location: NSTextLocation) -> NSTextLineFragment?
func textLineFragment(at point: CGPoint) -> NSTextLineFragment?
func extraLineTextLayoutFragment() -> NSTextLayoutFragment?
func extraLineTextLineFragment() -> NSTextLineFragment?
func caretLocation(interactingAt point: CGPoint, inContainerAt containerLocation: NSTextLocation) -> NSTextLocation?
func textSegmentFrame(at location: NSTextLocation, type: NSTextLayoutManager.SegmentType, options: SegmentOptions = [.upstreamAffinity]) -> CGRect?
func textSegmentFrame(in textRange: NSTextRange, type: NSTextLayoutManager.SegmentType, options: SegmentOptions = [.upstreamAffinity, .rangeNotRequired]) -> CGRect?
func textSegmentFrames(in textRange: NSTextRange, type: NSTextLayoutManager.SegmentType, options: SegmentOptions = [.upstreamAffinity, .rangeNotRequired]) -> [CGRect]
func typographicBounds(in textRange: NSTextRange) -> CGRect?
func enumerateTextLayoutFragments(in range: NSTextRange, options: NSTextLayoutFragment.EnumerationOptions = [], using block: (NSTextLayoutFragment) -> Bool) -> NSTextLocation?
var insertionPointLocations: [NSTextLocation]
var insertionPointSelections: [NSTextSelection]
NSTextLayoutFragment Additions
var isExtraLineFragment: Bool
func textLineFragment(at location: NSTextLocation, in textContentManager: NSTextContentManager? = nil) -> NSTextLineFragment?
func textLineFragment(at location: CGPoint, in textContentManager: NSTextContentManager? = nil) -> NSTextLineFragment?
NSTextLineFragment Additions
textRange(in textLayoutFragment: NSTextLayoutFragment) -> NSTextRange?
var isExtraLineFragment: Bool
NSTextLocation Addition
static func == (lhs: Self, rhs: Self) -> Bool
static func != (lhs: Self, rhs: Self) -> Bool
static func < (lhs: Self, rhs: Self) -> Bool
static func <= (lhs: Self, rhs: Self) -> Bool
static func > (lhs: Self, rhs: Self) -> Bool
static func >= (lhs: Self, rhs: Self) -> Bool
static func ~= (lhs: Self, rhs: Self) -> Bool
Contributing and Collaboration
I'd love to hear from you! Get in touch via an issue or pull request.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
