{"id":20690520,"url":"https://github.com/octree/attributedtext","last_synced_at":"2025-09-27T06:30:39.171Z","repository":{"id":40636454,"uuid":"359735613","full_name":"octree/AttributedText","owner":"octree","description":"An elegant way to build NSAttributedString just like SwiftUI.","archived":false,"fork":false,"pushed_at":"2022-06-27T08:35:37.000Z","size":200,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-12T09:59:56.332Z","etag":null,"topics":["ios","macos","nsattributedstring","resultbuilder","swift"],"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/octree.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":"2021-04-20T08:10:45.000Z","updated_at":"2024-08-24T15:26:39.000Z","dependencies_parsed_at":"2022-08-26T12:34:16.203Z","dependency_job_id":null,"html_url":"https://github.com/octree/AttributedText","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octree%2FAttributedText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octree%2FAttributedText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octree%2FAttributedText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octree%2FAttributedText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octree","download_url":"https://codeload.github.com/octree/AttributedText/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234399312,"owners_count":18826069,"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","macos","nsattributedstring","resultbuilder","swift"],"created_at":"2024-11-16T23:13:29.112Z","updated_at":"2025-09-27T06:30:33.902Z","avatar_url":"https://github.com/octree.png","language":"Swift","readme":"# AttributedText\n\nAn elegant way to build `NSAttributedString` like SwiftUI. \n\nPower by swift `Result Builder`\n\n\n\n## Usage\n\n```swift\nlet list = [\"hello\", \"world\"]\n\nlet attributedText: NSAttributedString = .Builder {\n  \"@resultBuilder\".bold.italic.foreground(color: .purple)\n  if #available(iOS 14, *) {\n    \"Wow\".lineHeight(20)\n  }\n}\n.build()\n```\n\n\n\n\u003e Attachment and Loops\n\n```swift\nlet list = [\"谈笑风生\", \"香港记者\", \"人生经验\", \"无可奉告\", \"身经百战\", \"亦可赛艇\", \"图样图森破\", \"另请高明\"]\ntextView.attributedText = .Builder {\n  Group {\n    attachment\n    \" Result builder is awesome\\n\".bold\n        .fontSize(24)\n        .foreground(color: .label)\n  }\n  .lineSpacing(8)\n\n  for element in list {\n    element.font(.systemFont(ofSize: 16))\n        .foreground(color: .random)\n        .lineSpacing(4)\n  }\n}\n.build()\n```\n\n![attachment](./Snapshots/attachment.png)\n\n## Installation\n\n### Swift Package Manager\n* File \u003e Swift Packages \u003e Add Package Dependency\n* Add https://github.com/octree/AttributedText.git\n* Select \"Up to Next Major\" with \"1.0.0\"\n\n\n\n## License\n\nAttributedText is available under the MIT license. See the LICENSE file for more info.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctree%2Fattributedtext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctree%2Fattributedtext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctree%2Fattributedtext/lists"}