Skip to content

Latest commit

 

History

History
79 lines (56 loc) · 3.05 KB

README.md

File metadata and controls

79 lines (56 loc) · 3.05 KB

Build Status Platforms Documentation Matrix

Glyph

Make life with TextKit better

Glyph adds features and abstractions for working with TextKit. Some are for performance, some for convenience. You don't even need to know whether your system using 1 or 2. Glyph will not downgrade TextKit 2 views. But, it can be awful nice to swap between 1 and 2 quickly when debugging.

Installation

dependencies: [
    .package(url: "https://github.com/ChimeHQ/Glyph", branch: "main")
],

Usage

NSTextContainer Additions

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 boundingRect(for range: NSRange) -> CGRect?

NSTextLayoutManager Additions

func enumerateLineFragments(for rect: CGRect, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -> Void)
func enumerateLineFragments(in range: NSRange, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -> Void)

NSTextLayoutFragment Additions

func enumerateLineFragments(with provider: NSTextElementProvider, block: (NSTextLineFragment, CGRect, NSRange) -> Void)

NSTextView/UITextView Additions

func characterIndexes(within rect: CGRect) -> IndexSet
var visibleCharacterIndexes: IndexSet
func boundingRect(for range: NSRange) -> CGRect?

NSRange and NSTextRange Additions

NSRange.init?(_ textRange: NSTextRange)
NSTextRange.init?(_ range: NSRange)

Contributing and Collaboration

I would love to hear from you! Issues or pull requests work great. A Matrix space is also available for live help, but I have a strong bias towards answering in the form of documentation.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.