{"id":20954940,"url":"https://github.com/ysoftware/appendattributedstring","last_synced_at":"2025-05-14T04:32:55.562Z","repository":{"id":35058268,"uuid":"39193467","full_name":"ysoftware/appendAttributedString","owner":"ysoftware","description":"An extension for NSMutableAttributedString","archived":false,"fork":false,"pushed_at":"2023-09-26T08:40:30.000Z","size":452,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-17T01:37:23.285Z","etag":null,"topics":["attributedstring","dynamic-font","dynamic-type","ios","nsattributedstring","string","string-manipulation","swift","swift5"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"geany/geany","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-16T11:35:28.000Z","updated_at":"2023-09-26T08:40:33.000Z","dependencies_parsed_at":"2022-09-16T05:14:14.466Z","dependency_job_id":null,"html_url":"https://github.com/ysoftware/appendAttributedString","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftware%2FappendAttributedString","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftware%2FappendAttributedString/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftware%2FappendAttributedString/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftware%2FappendAttributedString/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysoftware","download_url":"https://codeload.github.com/ysoftware/appendAttributedString/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254071345,"owners_count":22009776,"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":["attributedstring","dynamic-font","dynamic-type","ios","nsattributedstring","string","string-manipulation","swift","swift5"],"created_at":"2024-11-19T01:17:03.937Z","updated_at":"2025-05-14T04:32:54.862Z","avatar_url":"https://github.com/ysoftware.png","language":"Swift","readme":"# append(attributedString, with: ease)\nSwift 5\n\n#### An extension that adds a way for easier work with NSMutableAttributedString.\n\nSupports dynamic fonts, colors, underlines, strike through, images and you can chain append calls.\nAnd with the AttributesBuilder class it's easy to create attribute sets for Attributed String.\n\nInstall with Cocoapods:\n```\npod 'appendAttributedString'\n```\n\nHere's an example:\n\n```swift\nlet label = UILabel()\nlabel.numberOfLines = 0\nview.backgroundColor = .darkGray\n\nlet string = NSMutableAttributedString()\n\n.appendHeadline(\"Life can rise,\\n\")\n\n// call chaining\n.appendFootnote(\"it can fall.\\n\\n\")\n\n// color, underline, strike through, superscript and others\n.append(\"But in the end\\nit's just carried \", color: .white)\n.append(\"with the wind\\n\",\n        color: .yellow,\n        font: .dynamic(.systemFont(ofSize: 10)),\n        baselineOffset: 5)\n.append(\"and one day everything you do will simply cease to be…\\n\\n\",\n        color: .green,\n        underlineStyle: .double)\n.append(\"Like a child's \", color: .white)\n\n// even images\n.append(image: UIImage(named: \"balloon\")!,\n        // (the image will not auto-adjust its height)\n        height: UIFontMetrics.default.scaledValue(for: 20))\n\n.append(\"\\n\\n\")\n\n// In specal cases use AttributesBuilder class for easier attributes set up\n.append(\"when it's lost,\\nit's a tragic affair\\n\",\n        with: AttributesBuilder()\n            .color(.white)\n            .shadow(offset: CGSize(width: -7, height: 3),\n                    blurRadius: 5, color: .yellow)\n            .outline(width: -2, color: .red)\n            .lineSpacing(30)\n            .align(.center))\n\n.append(\"- but it is quickly forgotten.\", with:\n    AttributesBuilder()\n        .strikeThrough(.double, color: .white)\n        .align(.right))\n\ntextView.attributedText = string\n```\n\n![result](https://github.com/ysoftware/appendAttributedStringWithEase/blob/master/image2.png?raw=true)\n\n\n\n**Breaking changes in 1.2:**\n\n*Removed:*\n```swift\nAttributesBuilder().paragraph(style: _)\n```\n\n*Added:*\n```swift\nAttributesBuilder().paragraphStyle(_)\n```\n\nTo ensure paragraph style to always be a mutable instance, the old method accepting a non-mutating instance was removed.\n\nThe new method also reads better.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysoftware%2Fappendattributedstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysoftware%2Fappendattributedstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysoftware%2Fappendattributedstring/lists"}