让 TextKit 的使用体验更佳
Glyph 为 TextKit 添加了功能和抽象。有些是为了性能,有些是为了方便。你甚至不需要知道你的系统使用的是 1 还是 2。Glyph 不会降低 TextKit 2 视图的性能。但是,在调试时,在 1 和 2 之间快速切换会非常方便。
dependencies: [
.package(url: "https://github.com/ChimeHQ/Glyph", branch: "main")
],
func characterIndexes(within rect: CGRect) -> IndexSet
func enumerateLineFragments(for rect: CGRect, strictIntersection: Bool, block: (CGRect, NSRange, inout Bool) -> Void)
func enumerateLineFragments(in range: NSRange, block: (CGRect, NSRange, inout Bool) -> Void)
func enumerateLineFragments(from index: Int, forward: Bool = true, block: (CGRect, NSRange, inout Bool) -> Void)
func lineFragment(for index: Int, offset: Int) -> (CGRect, NSRange)?
func boundingRect(for range: NSRange) -> CGRect?
func enumerateLineFragments(for rect: CGRect, strictIntersection: Bool = true, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -> Void)
func enumerateLineFragments(in range: NSRange, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -> Void)
func enumerateLineFragments(from index: Int, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -> Void)
func boundingRect(for range: NSRange) -> CGRect?
func enumerateLineFragments(with provider: NSTextElementProvider, reverse: Bool = false, block: (NSTextLineFragment, CGRect, NSRange, Int) -> Bool)
func enumerateLineFragments(in range: NSRange, with provider: NSTextElementProvider, reverse: Bool = false, block: (NSTextLineFragment, CGRect, NSRange, Int) -> Bool)
func characterIndexes(within rect: CGRect) -> IndexSet
var visibleCharacterIndexes: IndexSet
func boundingRect(for range: NSRange) -> CGRect?
func setRenderingAttributes(_ attributes: [NSAttributedString.Key : Any], for range: NSRange)
NSRange.init?(_ textRange: NSTextRange)
NSTextRange.init?(_ range: NSRange)
我很乐意听到您的反馈!问题或拉取请求都非常欢迎。Matrix 空间 和 Discord 均可提供实时帮助,但我更倾向于以文档的形式回复。您也可以在这里找到我 here。
我更喜欢协作,如果您有类似的项目,我很乐意找到合作的方式。
为了提高可访问性,我更喜欢使用制表符进行缩进。但是,我宁愿您使用您喜欢的系统并提交 PR,也不希望您因为空格而犹豫不决。
通过参与本项目,您同意遵守 贡献者行为准则。