{"id":16221556,"url":"https://github.com/hlfcoding/uitextextensions","last_synced_at":"2026-04-24T12:06:38.228Z","repository":{"id":56913582,"uuid":"94038880","full_name":"hlfcoding/UITextExtensions","owner":"hlfcoding","description":":label: UIKit convenience extensions for text styling in code","archived":false,"fork":false,"pushed_at":"2017-06-19T00:44:42.000Z","size":74,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T00:44:23.173Z","etag":null,"topics":["ios","swift","uilabel","uitextfield","uitextview"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hlfcoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-11T23:52:15.000Z","updated_at":"2019-11-05T01:39:15.000Z","dependencies_parsed_at":"2022-08-20T20:50:34.291Z","dependency_job_id":null,"html_url":"https://github.com/hlfcoding/UITextExtensions","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfcoding%2FUITextExtensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfcoding%2FUITextExtensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfcoding%2FUITextExtensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hlfcoding%2FUITextExtensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hlfcoding","download_url":"https://codeload.github.com/hlfcoding/UITextExtensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755570,"owners_count":20990622,"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":["ios","swift","uilabel","uitextfield","uitextview"],"created_at":"2024-10-10T12:08:47.542Z","updated_at":"2026-04-24T12:06:33.188Z","avatar_url":"https://github.com/hlfcoding.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TextExtensions\n\n[![Version](https://img.shields.io/cocoapods/v/HLFUITextExtensions.svg?style=flat)](http://cocoapods.org/pods/HLFUITextExtensions)\n[![License](https://img.shields.io/cocoapods/l/HLFUITextExtensions.svg?style=flat)](http://cocoapods.org/pods/HLFUITextExtensions)\n[![Platform](https://img.shields.io/cocoapods/p/HLFUITextExtensions.svg?style=flat)](http://cocoapods.org/pods/HLFUITextExtensions)\n[![Code Climate](https://codeclimate.com/github/hlfcoding/UITextExtensions/badges/gpa.svg)](https://codeclimate.com/github/hlfcoding/UITextExtensions)\n\n\u003e :label: \u0026nbsp; UIKit convenience extensions for text styling in code.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/100884/27258670-9f75ec7a-53b5-11e7-8866-b8dff74393ff.png\" width=\"320\" /\u003e\n\n## Example\n\n```swift\nlet label = UILabel()\nlabel.font = .preferredFont(forTextStyle: .title1)\nlabel.numberOfLines = 0\nlabel.textAlignment = .center\nlabel.textColor = .darkText\nlabel.hlf_updateText(\"Hello, playground. You are looking okay.\")\n\nlabel.hlf_setKerning(-0.5)\nlabel.hlf_setLineHeight(label.hlf_pointsByEms(1.1))\n// ...\nlabel.hlf_updateText(\"Hello, playground. You are looking good.\")\n\nlet width = label.hlf_pointsByEms(9)\nlabel.frame.size.width = width\nlabel.sizeToFit()\n// ...\n```\n\nCompare the above with the (less flexible) below:\n\n```swift\nlet label = UILabel()\nlabel.numberOfLines = 0\n\nvar attributes = [String : Any]()\nlet font = UIFont.preferredFont(forTextStyle: .title1)\nattributes[NSFontAttributeName] = font\nattributes[NSForegroundColorAttributeName] = UIColor.darkText\nattributes[NSKernAttributeName] = -0.5\nlet paragraphStyle = NSMutableParagraphStyle()\nparagraphStyle.alignment = NSTextAlignment.center\nparagraphStyle.maximumLineHeight = round(1.1 * font.pointSize)\nattributes[NSParagraphStyleAttributeName] = paragraphStyle\nlabel.attributedText = NSAttributedString(\n  string: \"Hello, playground. You are looking okay.\", attributes: attributes\n)\n// ...\nlabel.attributedText = NSAttributedString(\n  string: \"Hello, playground. You are looking good.\", attributes: attributes\n)\n\nlet width = round(9 * font.pointSize)\nlabel.frame.size.width = width\nlabel.sizeToFit()\n// ...\n```\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\nSwift 3+\n\n## Installation\n\nTextExtensions is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"HLFUITextExtensions\"\n```\n\n## Author\n\nPeng Wang, peng@pengxwang.com\n\n## License\n\nTextExtensions is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfcoding%2Fuitextextensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhlfcoding%2Fuitextextensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhlfcoding%2Fuitextextensions/lists"}