{"id":13990758,"url":"https://github.com/KyoheiG3/AttributedLabel","last_synced_at":"2025-07-22T13:31:27.438Z","repository":{"id":56902492,"uuid":"39212766","full_name":"KyoheiG3/AttributedLabel","owner":"KyoheiG3","description":"Easy to use, fast, and higher performance than UILabel.","archived":false,"fork":false,"pushed_at":"2019-04-08T07:56:25.000Z","size":85,"stargazers_count":523,"open_issues_count":3,"forks_count":38,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-07-27T20:44:32.208Z","etag":null,"topics":["attributedlabel","ios","swift","tvos","uilabel"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/KyoheiG3.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":"2015-07-16T18:11:49.000Z","updated_at":"2024-07-27T20:44:32.208Z","dependencies_parsed_at":"2022-08-21T01:50:39.823Z","dependency_job_id":null,"html_url":"https://github.com/KyoheiG3/AttributedLabel","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FAttributedLabel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FAttributedLabel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FAttributedLabel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyoheiG3%2FAttributedLabel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KyoheiG3","download_url":"https://codeload.github.com/KyoheiG3/AttributedLabel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":214668598,"owners_count":15767199,"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":["attributedlabel","ios","swift","tvos","uilabel"],"created_at":"2024-08-09T13:03:11.299Z","updated_at":"2024-08-09T13:11:21.805Z","avatar_url":"https://github.com/KyoheiG3.png","language":"Swift","readme":"# AttributedLabel\n\n[![Build Status](https://travis-ci.org/KyoheiG3/AttributedLabel.svg?branch=master)](https://travis-ci.org/KyoheiG3/AttributedLabel)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/AttributedLabel.svg?style=flat)](http://cocoadocs.org/docsets/AttributedLabel)\n[![License](https://img.shields.io/cocoapods/l/AttributedLabel.svg?style=flat)](http://cocoadocs.org/docsets/AttributedLabel)\n[![Platform](https://img.shields.io/cocoapods/p/AttributedLabel.svg?style=flat)](http://cocoadocs.org/docsets/AttributedLabel)\n\n![Graph](https://user-images.githubusercontent.com/5707132/33195812-1a93b3ac-d11e-11e7-89de-f5b5d21ac4a8.png)\n\n##### Higher performance than `UILabel`.\n\n#### [Appetize's Demo](https://appetize.io/app/7q459fyg56828caye3ucdntqp0)\n\n![Label](https://user-images.githubusercontent.com/5707132/33195811-182c5128-d11e-11e7-8945-0c4244429e19.gif)\n\n## Overview\n\nThis is a better performance than `UILabel` and can be used like a standard UI component.\nAlso, Easier to use than `UILabel`.\n\nSince `UIView` is inherited instead of `UILabel`, there is little wasteful processing.\nIt uses the function of TextKit to draw characters.\n\nHowever, please note that content layout is not done automatically.\nIf want to automatically fix the height of the content, set `usesIntrinsicContentSize` to `true`.\n\n##### Customization is easy.\n\n![Customize](https://user-images.githubusercontent.com/5707132/33195810-159c27bc-d11e-11e7-9a8b-45c9c20567fd.gif)\n\nLeft tab is customizable label. The center tab AttributedLabel So fast. Right tab is UILabel So slow. Fast more than 10 times from 5 times.\n\n- use the UIlabel\n\n![UILabel](https://user-images.githubusercontent.com/5707132/33195814-1d55f622-d11e-11e7-8e8a-71ac9bc72375.png)\n\n- use the AttributedLabel\n\n![AttributedLabel](https://user-images.githubusercontent.com/5707132/33195809-138ddda8-d11e-11e7-80fe-1ee33441d4b8.png)\n!\n## Requirements\n\n- Swift 5.0\n- iOS 7.0 or later\n- tvOS 9.0 or later\n\n## How to Install AttributedLabel\n\n### iOS 8+, tvOS\n\n#### CocoaPods\n\nAdd the following to your `Podfile`:\n\n```Ruby\npod \"AttributedLabel\"\n```\n\n#### Carthage\n\nAdd the following to your `Cartfile`:\n\n```Ruby\ngithub \"KyoheiG3/AttributedLabel\"\n```\n\n### iOS 7\n\nJust add everything in the `AttributedLabel.swift` file to your project.\n\n## Usage\n\n### Variable\n\n```swift\nvar numberOfLines: Int\n```\n- Same as `numberOfLines` of `UILabel`.\n- Default is `0`.\n\n```swift\nvar contentAlignment: AttributedLabel.ContentAlignment\n```\n- Alignment of content.\n- Default is `left`.\n\n```swift\n@IBInspectable var padding: CGFloat\n```\n- `lineFragmentPadding` of `NSTextContainer`.\n- default is `0`.\n\n```swift\nvar font: UIFont\n```\n- Text font.\n- Default is system font 17 plain.\n\n```swift\nvar lineBreakMode: NSLineBreakMode\n```\n- Same as `lineBreakMode` of `UILabel`.\n- Default is `ByTruncatingTail`.\n\n```swift\n@IBInspectable var textColor: UIColor?\n```\n- Default is nil (text draws black).\n\n```swift\nvar paragraphStyle: NSParagraphStyle?\n```\n- Default is nil.\n\n```swift\nvar shadow: NSShadow?\n```\n- Default is nil.\n\n```swift\nvar attributedText: NSAttributedString?\n```\n- Default is nil.\n\n```swift\n@IBInspectable var text: String?\n```\n- Default is nil.\n\n```swift\nvar usesIntrinsicContentSize: Bool\n```\n- If need to use intrinsicContentSize set true.\n- Should call invalidateIntrinsicContentSize when intrinsicContentSize is cached. When text was changed for example.\n- Default is `false`.\n\n```swift\nvar preferredMaxLayoutWidth: CGFloat\n```\n- Support for constraint-based layout (auto layout)\n- If nonzero, this is used when determining intrinsicContentSize for multiline labels\n\n### Function\n\n```swift\noverride func sizeThatFits(size: CGSize) -\u003e CGSize\n```\n- Same as `sizeThatFits` of `UILabel`.\n\n```swift\noverride func sizeToFit()\n```\n- Fit like `UILabel`.\n\n## Author\n\n#### Kyohei Ito\n\n- [GitHub](https://github.com/kyoheig3)\n- [Twitter](https://twitter.com/kyoheig3)\n\nFollow me 🎉\n\n## LICENSE\n\nUnder the MIT license. See LICENSE file for details.\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKyoheiG3%2FAttributedLabel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKyoheiG3%2FAttributedLabel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKyoheiG3%2FAttributedLabel/lists"}