{"id":22359773,"url":"https://github.com/brunomunizaf/multiattributedstring","last_synced_at":"2025-03-26T14:17:40.649Z","repository":{"id":203445623,"uuid":"709617055","full_name":"brunomunizaf/MultiAttributedString","owner":"brunomunizaf","description":"A Swift extension for NSAttributedString that offers a streamlined approach to applying and managing multiple text attributes.","archived":false,"fork":false,"pushed_at":"2023-10-26T05:05:05.000Z","size":11,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T17:54:09.923Z","etag":null,"topics":["ios","nsattributedstring","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/brunomunizaf.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-25T03:44:57.000Z","updated_at":"2023-10-25T04:11:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"870b75ee-a77b-4eae-b9bf-d6af6030a153","html_url":"https://github.com/brunomunizaf/MultiAttributedString","commit_stats":null,"previous_names":["brunomunizaf/multiattributedstring"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunomunizaf%2FMultiAttributedString","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunomunizaf%2FMultiAttributedString/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunomunizaf%2FMultiAttributedString/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunomunizaf%2FMultiAttributedString/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunomunizaf","download_url":"https://codeload.github.com/brunomunizaf/MultiAttributedString/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245668640,"owners_count":20653008,"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","nsattributedstring","swift"],"created_at":"2024-12-04T15:27:32.520Z","updated_at":"2025-03-26T14:17:40.626Z","avatar_url":"https://github.com/brunomunizaf.png","language":"Swift","readme":"# MultiAttributedString\n\n`MultiAttributedString` provides a convenient way to generate `NSAttributedString` with varying text attributes for different sections of a string, based on user-defined symbol delimiters.\n\n## Features\n\n- [x] Easily apply varied text attributes (e.g., font, color, links) to distinct parts of a string.\n- [x] Use custom symbol delimiters to dictate where attributes should be applied in the string.\n- [ ] Support for escaped symbols, allowing them to be interpreted as regular characters instead of attribute delimiters.\n- [ ] Capability to handle nested symbol pairs, with attributes from the innermost symbols given priority.\n\n## Usage\n\n### Installation\n\nTo integrate `MultiAttributedString` into your project, use the Swift Package Manager (SPM):\n\n1. In Xcode, go to \"File\" \u003e \"Swift Packages\" \u003e \"Add Package Dependency...\"\n2. Enter `https://github.com/brunomunizaf/MultiAttributedString.git`\n3. Follow the prompts to complete the installation.\n\n### Example\n\nHere's a basic example of how to use `MultiAttributedString`:\n\n```swift\nimport MultiAttributedString\n\nlet attributedString = \"This is $red$ text, and this is #blue small# text\".applying(\n  attributes: [\n    \"$\": [.foregroundColor: UIColor.red],\n    \"#\": [.foregroundColor: UIColor.blue, .font: UIFont.systemFont(withSize: 10.0)]\n  ]\n)\n```\n\nIn this example, we define symbol pairs (e.g., `$` and `#`) with associated attributes. Then, we create an attributed string using the `.applying(attributes:)` method.\n\n### Escaping Symbols (In progress ⏳)\n\nYou can use the backslash (`\\`) as an escape character to treat symbols as literals. For example:\n\n```swift\nlet inputString = \"This is \\\\$not red\\\\$ text but this is $red$.\"\n```\n\nIn the above string, \\\\$ and \\\\$ are treated as literal symbols and will not trigger attribute application.\n\n### Unit Tests\n\nThe repository includes unit tests to ensure the correct functionality of the library. You can run these tests in Xcode to verify that everything is working as expected.\n\n### License\n\n`MultiAttributedString` is distributed under the [MIT license](https://github.com/brunomunizaf/MultiAttributedString/blob/master/LICENSE).\n\n### Contributing\n\nContributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or create a pull request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunomunizaf%2Fmultiattributedstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunomunizaf%2Fmultiattributedstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunomunizaf%2Fmultiattributedstring/lists"}