{"id":16684824,"url":"https://github.com/nirma/attributed","last_synced_at":"2025-04-12T20:44:11.240Z","repository":{"id":53784728,"uuid":"75892077","full_name":"Nirma/Attributed","owner":"Nirma","description":"µframework for Attributed strings.","archived":false,"fork":false,"pushed_at":"2023-03-10T07:08:04.000Z","size":119,"stargazers_count":754,"open_issues_count":2,"forks_count":37,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-10-13T14:45:17.137Z","etag":null,"topics":["attributedlabel","attributedstring","attributedtext"],"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/Nirma.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-12-08T01:45:56.000Z","updated_at":"2024-07-11T15:52:28.000Z","dependencies_parsed_at":"2024-01-29T18:06:33.509Z","dependency_job_id":null,"html_url":"https://github.com/Nirma/Attributed","commit_stats":{"total_commits":106,"total_committers":21,"mean_commits":"5.0476190476190474","dds":0.3207547169811321,"last_synced_commit":"5651f91fb7dfb189dd611b18f47a1069b4b35bcf"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nirma%2FAttributed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nirma%2FAttributed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nirma%2FAttributed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nirma%2FAttributed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nirma","download_url":"https://codeload.github.com/Nirma/Attributed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631687,"owners_count":21136556,"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","attributedstring","attributedtext"],"created_at":"2024-10-12T14:45:10.772Z","updated_at":"2025-04-12T20:44:11.201Z","avatar_url":"https://github.com/Nirma.png","language":"Swift","readme":"# Attributed\n[![Build Status](https://travis-ci.org/Nirma/Attributed.svg?branch=master)](https://travis-ci.org/Nirma/Attributed)\n![CodeCov](https://img.shields.io/codecov/c/github/Nirma/Attributed.svg)\n![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/AttributedLib.svg)](#cocoapods)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)\n\nµframework for Attributed strings.\n\n## What is Attributed?\nAttributed aims to be a drop in replacement to the current version of the `NSAttributedString` API.\n\nThe `NSAttributedString` interface has a few shortcomings. If you donʼt know the key and type of value needed to set a certain attribute, you have to spend time checking documentation. Another concern is safety: passing a dictionary of type `[String: Any]` to the constructor of `NSAttributedString` is a potential crash at runtime waiting to happen.\n\nAttributed provides developers a nicer alternative by extending the current `NSAttributedString` interface with a fluent, strongly typed, and easy to use API.\n\n# Features\n- [x] Create `NSAttributedString` instances with a strongly typed, simple, and fluid interface\n- [x] Combine `NSAttributedString`s with `+`\n- [x] Partially apply Attributes to parts of an `NSAttributedString` by providing a `Range`\n\n### Donʼt see a feature you need?\nFeel free to open an [issue](https://github.com/Nirma/Attributed/issues) requesting the feature you want or send over a pull request!\n\n# Usage  \n\n### Creating a new `NSAttributedString` by closure composition\n\n```swift\n\n\"This is not a string\".at.attributed {\n  return $0.foreground(color: .red)\n           .font(UIFont(name: \"Chalkduster\", size: 24.0)!)\n           .underlineStyle(.styleSingle)\n}\n```\n\n### Creating a new `NSAttributedString` by passing an attributes object\n\nFirst create an `Attributes` object:\n\n```swift\nlet attributes = Attributes {\n    return $0.foreground(color: .red)\n             .font(UIFont(name: \"Chalkduster\", size: 24.0)!)\n             .underlineStyle(.styleSingle)\n}\n```\n\nthen simply apply the `Attributes` to a `String`:\n\n```swift\n\"Hello\".at.attributed(with: attributes)\n```\n\n### Combining `NSAttributedString` with `+`\nThis library defines an concatenation operator `+` for concatentating instances of `NSAttributedString`.\n`+` works with `NSAttributedString` no different than it does for `String`.\nThis can be useful for combining `NSAttributedStrings` with different attributes to produce the \ndesired effect without having to specify ranges to apply different attributes to.\n\n```swift\nlet bodyAttributes = Attributes { \n    return $0.foreground(color: .purple)\n             .font(UIFont(name: \"Noteworthy-Light\", size: 20.0)!)\n}\n\nlet authorAttributes = bodyAttributes.foreground(color: .black)\n\n\"I think theres something strangely musical about noise.\".at.attributed(with: bodyAttributes)\n+ \"\\n  - Trent Reznor\".at.attributed(with: authorAttributes)\n```\n\n## Installation\n\n#### Carthage\n\nIf you use Carthage to manage your dependencies, simply add\nAttributed to your `Cartfile`:\n\n```\ngithub \"Nirma/Attributed\"\n```\n\nIf you use Carthage to build your dependencies, make sure you have added `Attributed.framework` to the \"_Linked Frameworks and Libraries_\" section of your target, and have included `Attributed.framework` in your Carthage framework copying build phase.\n\n#### CocoaPods\n\nIf you use CocoaPods to manage your dependencies, simply add\nAttributed to your `Podfile`:\n\n```ruby\npod 'AttributedLib'\n```\n\n## Requirements\n\n* Xcode 9.0\n* Swift 4.0+\n\n## Contribution\nContributions are more than welcome!\n\n## License\n\nAttributed is free software, and may be redistributed under the terms specified in the [LICENSE] file.\n\n[LICENSE]: /LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirma%2Fattributed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirma%2Fattributed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirma%2Fattributed/lists"}