{"id":20683154,"url":"https://github.com/chimehq/glyph","last_synced_at":"2025-04-22T12:21:36.601Z","repository":{"id":231695281,"uuid":"782460529","full_name":"ChimeHQ/Glyph","owner":"ChimeHQ","description":"Make life with TextKit better","archived":false,"fork":false,"pushed_at":"2025-02-27T18:22:12.000Z","size":95,"stargazers_count":33,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T05:22:59.826Z","etag":null,"topics":["nstextview","swift","textkit","textkit2","uitextview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChimeHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["mattmassicotte"]}},"created_at":"2024-04-05T10:52:59.000Z","updated_at":"2025-02-27T18:22:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"6bee37c8-1b09-4dbb-aa9b-1ad275803d99","html_url":"https://github.com/ChimeHQ/Glyph","commit_stats":null,"previous_names":["chimehq/glyph"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGlyph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGlyph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGlyph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGlyph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChimeHQ","download_url":"https://codeload.github.com/ChimeHQ/Glyph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237851,"owners_count":21397403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nstextview","swift","textkit","textkit2","uitextview"],"created_at":"2024-11-16T22:15:37.476Z","updated_at":"2025-04-22T12:21:36.584Z","avatar_url":"https://github.com/ChimeHQ.png","language":"Swift","funding_links":["https://github.com/sponsors/mattmassicotte"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Build Status][build status badge]][build status]\n[![Platforms][platforms badge]][platforms]\n[![Documentation][documentation badge]][documentation]\n[![Matrix][matrix badge]][matrix]\n\n\u003c/div\u003e\n\n# Glyph\nMake life with TextKit better\n\nGlyph 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.\n\n## Installation\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ChimeHQ/Glyph\", branch: \"main\")\n],\n```\n\n## Usage\n\n### `NSTextContainer` Additions\n\n```swift\nfunc characterIndexes(within rect: CGRect) -\u003e IndexSet\nfunc enumerateLineFragments(for rect: CGRect, strictIntersection: Bool, block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc enumerateLineFragments(in range: NSRange, block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc enumerateLineFragments(from index: Int, forward: Bool = true, block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc lineFragment(for index: Int, offset: Int) -\u003e (CGRect, NSRange)?\nfunc boundingRect(for range: NSRange) -\u003e CGRect?\n```\n\n### `NSTextLayoutManager` Additions\n\n```swift\nfunc enumerateLineFragments(for rect: CGRect, strictIntersection: Bool = true, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc enumerateLineFragments(in range: NSRange, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc enumerateLineFragments(from index: Int, options: NSTextLayoutFragment.EnumerationOptions = [], block: (CGRect, NSRange, inout Bool) -\u003e Void)\nfunc boundingRect(for range: NSRange) -\u003e CGRect? \n```\n\n### `NSTextLayoutFragment` Additions\n\n```swift\nfunc enumerateLineFragments(with provider: NSTextElementProvider, reverse: Bool = false, block: (NSTextLineFragment, CGRect, NSRange, Int) -\u003e Bool)\nfunc enumerateLineFragments(in range: NSRange, with provider: NSTextElementProvider, reverse: Bool = false, block: (NSTextLineFragment, CGRect, NSRange, Int) -\u003e Bool)\n```\n\n### `NSTextView`/`UITextView` Additions\n\n```swift\nfunc characterIndexes(within rect: CGRect) -\u003e IndexSet\nvar visibleCharacterIndexes: IndexSet\nfunc boundingRect(for range: NSRange) -\u003e CGRect?\n\nfunc setRenderingAttributes(_ attributes: [NSAttributedString.Key : Any], for range: NSRange)\n```\n\n### `NSRange` and `NSTextRange` Additions\n\n```swift\nNSRange.init?(_ textRange: NSTextRange)\nNSTextRange.init?(_ range: NSRange)\n```\n\n## Contributing and Collaboration\n\nI would love to hear from you! Issues or pull requests work great. Both a [Matrix space][matrix] and [Discord][discord] are available for live help, but I have a strong bias towards answering in the form of documentation. You can also find me [here](https://www.massicotte.org/about).\n\nI prefer collaboration, and would love to find ways to work together if you have a similar project.\n\nI 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.\n\nBy participating in this project you agree to abide by the [Contributor Code of Conduct](CODE_OF_CONDUCT.md).\n\n[build status]: https://github.com/ChimeHQ/Glyph/actions\n[build status badge]: https://github.com/ChimeHQ/Glyph/workflows/CI/badge.svg\n[platforms]: https://swiftpackageindex.com/ChimeHQ/Glyph\n[platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FChimeHQ%2FGlyph%2Fbadge%3Ftype%3Dplatforms\n[documentation]: https://swiftpackageindex.com/ChimeHQ/Glyph/main/documentation\n[documentation badge]: https://img.shields.io/badge/Documentation-DocC-blue\n[matrix]: https://matrix.to/#/%23chimehq%3Amatrix.org\n[matrix badge]: https://img.shields.io/matrix/chimehq%3Amatrix.org?label=Matrix\n[discord]: https://discord.gg/esFpX6sErJ\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimehq%2Fglyph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchimehq%2Fglyph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimehq%2Fglyph/lists"}