{"id":20685062,"url":"https://github.com/geri-borbas/ios.blog.uilabel_typography_extensions","last_synced_at":"2025-08-04T23:11:30.676Z","repository":{"id":40314632,"uuid":"323603394","full_name":"Geri-Borbas/iOS.Blog.UILabel_Typography_Extensions","owner":"Geri-Borbas","description":"Set UILabel line height, letter spacing (and more). 📐","archived":false,"fork":false,"pushed_at":"2022-05-15T18:24:52.000Z","size":7029,"stargazers_count":70,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T15:34:39.450Z","etag":null,"topics":["extension","ios","letter-spacing","line-height","nsattributedstring","nskeyvalueobservation","strikethrough","swift","typography","uikit","uilabel","underline"],"latest_commit_sha":null,"homepage":"http://blog.eppz.eu/uilabel-line-height-letter-spacing-and-more-uilabel-typography-extensions/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Geri-Borbas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-22T11:13:16.000Z","updated_at":"2025-02-11T13:02:01.000Z","dependencies_parsed_at":"2022-08-18T07:10:35.770Z","dependency_job_id":null,"html_url":"https://github.com/Geri-Borbas/iOS.Blog.UILabel_Typography_Extensions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FiOS.Blog.UILabel_Typography_Extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FiOS.Blog.UILabel_Typography_Extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FiOS.Blog.UILabel_Typography_Extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FiOS.Blog.UILabel_Typography_Extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Geri-Borbas","download_url":"https://codeload.github.com/Geri-Borbas/iOS.Blog.UILabel_Typography_Extensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250249858,"owners_count":21399534,"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":["extension","ios","letter-spacing","line-height","nsattributedstring","nskeyvalueobservation","strikethrough","swift","typography","uikit","uilabel","underline"],"created_at":"2024-11-16T22:25:22.993Z","updated_at":"2025-04-22T13:39:02.776Z","avatar_url":"https://github.com/Geri-Borbas.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UILabel Typography Extensions 📐\nSet `UILabel` line height, letter spacing (and more).\n\n```Swift\nlet headerLabel = UILabel()\nheaderLabel.textColor = UIColor(named: \"Mars\")\nheaderLabel.font = UIFont(name: \"HelveticaNeue-CondensedBlack\", size: 100)\nheaderLabel.lineHeight = 80\nheaderLabel.letterSpacing = 100 * -0.02\nheaderLabel.text = \"Mars\"\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"Documentation/UlLabel_Line_Height_Letter_Spacing_Extension_UIKit.png\" width=\"900\"\u003e\u003c/p\u003e\n\nSee the complementary article at [**UILabel line height, letter spacing and more** UILabel typography extensions].\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"Documentation/UILabel_Line_Height_Simulator_Figma_Overlay.png\" width=\"900\"\u003e\u003c/p\u003e\n\n## How it works\n\nIt is an extension on `UILabel` that adds some typographic properties using [**Objective-C Runtime**] (for stored properties on a Swift extension), [`NSAttributedString`] (for manage typographic properties), and [`NSKeyValueObservation`] (to be able to use the regular `text` property to manage text content).\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"Documentation/UILabel_Line_Height_NSAttributedString_BaselineOffset.png\" width=\"900\"\u003e\u003c/p\u003e\n\nIt also takes care of `baselineOffset` values to keep the text content in the vertical center (right). By default, `NSAttributedString` sticks multiline label content to the top of the container view (left), which makes it hard to \nmatch the UI with the design specifications.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"Documentation/UILabel_Line_Height_Xcode_Figma.png\" width=\"900\"\u003e\u003c/p\u003e\n\nUsing this extension you can build screens that 100% match design specifications. More on that in the article at [**UILabel line height, letter spacing and more** UILabel typography extensions].\n\n\n## License\n\n\u003e Licensed under the [**MIT License**](https://en.wikipedia.org/wiki/MIT_License).\n\n[**Objective-C Runtime**]: https://developer.apple.com/documentation/objectivec/objective-c_runtime\n[`NSAttributedString`]: https://developer.apple.com/documentation/foundation/nsattributedstring\n[`NSKeyValueObservation`]: https://developer.apple.com/documentation/foundation/nskeyvalueobservation\n[**UILabel line height, letter spacing and more** UILabel typography extensions]: http://blog.eppz.eu/uilabel-line-height-letter-spacing-and-more-uilabel-typography-extensions/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeri-borbas%2Fios.blog.uilabel_typography_extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeri-borbas%2Fios.blog.uilabel_typography_extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeri-borbas%2Fios.blog.uilabel_typography_extensions/lists"}