{"id":16482763,"url":"https://github.com/shaps80/spxsubscripting","last_synced_at":"2025-07-03T03:05:21.977Z","repository":{"id":26676499,"uuid":"30133154","full_name":"shaps80/SPXSubscripting","owner":"shaps80","description":"This is a library for adding subscripting support to various Foundation classes. It also adds some interesting solutions to working with NSString's, NSAttributedString's and their attributes.","archived":false,"fork":false,"pushed_at":"2015-02-01T02:13:41.000Z","size":180,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T00:07:19.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/shaps80.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-02-01T01:55:07.000Z","updated_at":"2016-05-13T11:09:05.000Z","dependencies_parsed_at":"2022-09-09T13:41:57.752Z","dependency_job_id":null,"html_url":"https://github.com/shaps80/SPXSubscripting","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/shaps80/SPXSubscripting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FSPXSubscripting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FSPXSubscripting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FSPXSubscripting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FSPXSubscripting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaps80","download_url":"https://codeload.github.com/shaps80/SPXSubscripting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaps80%2FSPXSubscripting/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263250604,"owners_count":23437288,"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":[],"created_at":"2024-10-11T13:11:55.961Z","updated_at":"2025-07-03T03:05:21.942Z","avatar_url":"https://github.com/shaps80.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SPXSubscripting\n\nThis is a library for adding subscripting support to various Foundation classes. It also adds some interesting solutions to working with NSString's, NSAttributedString's and their attributes.\n\n## Foundation Classes\n\nThe following Foundation classes have been extended.\n\n```objc\nNSArray\nNSOrderedSet\nNSMutableOrderedSet\nNSMapTable\nNSString\nNSMutableString\nNSAttributedString\nNSMutableAttributedString\nNSOperationQueue\n```\n\n## NSAttributedString\n\nIn addition to standard subscripting options, NSAttributed string now provides additional convenience through subscripting.\n\nI've provided a simple shorthand for generating an NSAtributedString:\n\n```objc\nNSMutableAttributedString *string = $(\"Attributed String\").mutableCopy;\n```\n\n```objc \nNSString *subString = [aString attributedSubstringFromRange:NSMakeRange(0, 10)];\n\n// can now be replaced with\n\nNSString *subString = aString[[@0:10]];\n```\n\nYou can even use assignments to replace a range:\n\n```objc\nNSMutableAttributedString *string = $(\"a\");\n[string replaceCharactersInRange:NSMakeRange(0, 1) withAttributedString:[NSAttributedString attributedStringWithString:@\"b\"]];\n\n// can now be replaced with\n\nstring[[@0:1]] = @\"b\";\n\n// if you want to replace part of a string ((or entirely from a given index), this is even simpler:\n\nstring[@0] = @\"b\";\n```\n\n\u003eNotice that NSAttributedString and NSString can now be used interchangeably in most cases.\n\n## NSAttributedString Attributes\n\nSo what about attributes? NSAttributedString now has a nice attributes properties that allows you to apply subscripting to your attributes too ;)\n\n```objc\n// If you need to replace attributes from a specific index\nstring.attributes[0] = attributes;\n\n// If you need to add a specific attribute to the entire string\nstring.attributes[NSKernAttributeName] = @2;\n\n// Thanks for the nicer syntax, you can even add a specific attribute to a range too (add 2.0 kerning to the range {0, 10}\nstring.attributes[[@0:10:NSKernAttributeName]] = @2;\n\n// Finally you can apply a series of attribuets to a range\nstring.attributes[[@0:10]] = attributes;\n```\n\n## Usage\n\nTo run the example project, clone the repo and run the project.\n\n## Installation\n\nSPXSubscripting is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n    pod 'SPXSubscripting'\n\n\n## License\n\nSPXSubscripting is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaps80%2Fspxsubscripting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaps80%2Fspxsubscripting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaps80%2Fspxsubscripting/lists"}