{"id":18031768,"url":"https://github.com/dagronf/dsffinderlabels","last_synced_at":"2025-07-25T14:05:53.215Z","repository":{"id":149491789,"uuid":"169815522","full_name":"dagronf/DSFFinderLabels","owner":"dagronf","description":"macOS Finder tags and labels support library for Swift and Objective-C","archived":false,"fork":false,"pushed_at":"2022-07-26T02:11:40.000Z","size":120,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T01:41:20.268Z","etag":null,"topics":["color","finder","labels","macos","objective-c","swift","tags"],"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/dagronf.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":"2019-02-09T00:12:19.000Z","updated_at":"2025-03-04T02:33:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4a4966d-6313-4bc0-855c-0f0574b70780","html_url":"https://github.com/dagronf/DSFFinderLabels","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dagronf/DSFFinderLabels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFinderLabels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFinderLabels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFinderLabels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFinderLabels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/DSFFinderLabels/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFinderLabels/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267016162,"owners_count":24021730,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["color","finder","labels","macos","objective-c","swift","tags"],"created_at":"2024-10-30T10:10:43.380Z","updated_at":"2025-07-25T14:05:53.177Z","avatar_url":"https://github.com/dagronf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift/ObjC Finder Tag/Label/Color class\n\nClass to retrieve and update Finder tags and colors for file URLs.\n\n## Why?\n\nIt seems quite difficult to update string and color tags for a particular url so that they appear in the Finder, and can be searched by Spotlight\n\n* The built-in API for colors only lets you assign a single color. The Finder allows you to set multiple colors.\n* Colors seem to be internally managed as String labels. For example, if you set a string tag called \"Blue\" (in English) then the finder item will have the internal \"Blue\" color set.\n* When in other languages (ie. you set up your computer in German), the localized names for the colors are difficult to map\n\nThis class (`DSFFinderLabels`) wraps these API calls to make a consistent method for updating Finder tags and colors\n\n## Features\n\n* Load all tags and colors for a url\n* Handles localization issues\n* Set multiple colors/tags all with a single call\n* Simple convenience UI elements for display\n\n## Simple install\n\n### Minimal file install\n\nAdd `DSFFinderLabels.swift` to your project. \n\nAdditionally, if you need Objective-C support also add `DSFFinderLabels+objc.swift`\n\n### Cocoapods\nAdd\n\n`pod 'DSFFinderLabels', :git =\u003e 'https://github.com/dagronf/DSFFinderLabels'` \n  \nto your Podfile\n\n## Simple usage\n\nThere are some tests which show the usage as well\n\n### Set tags and colors for some files\n\n#### Swift\n\n```swift\nlet labels = DSFFinderLabels()\n\n// Add some colors\nlabels.set(colors: [.blue, .green])\nlabels += .green\n\n// Add a tag\nlabels.set(tags: [\"Work Related\"])\nlabels += \"Client\"\n\n// And update some files label(s) and color(s)\ndo {\n\tlet url = URL(string: \"file:///Users/blah/Desktop/file.txt\")!\n\tlet url2 = URL(string: \"file:///Users/blah/Desktop/file2.txt\")!\n\tlet url3 = URL(string: \"file:///Users/blah/Desktop/file3.txt\")!\n\n\ttry labels.update([url, url2, url3])\n}\ncatch {\n\tprint(error)\n}\n```\n\n#### Objective-C\n\n```objective-c\nNSURL* fileUrl = ...\nDSFFinderLabels* labels = [fileUrl finderLabels];\nNSSet\u003cNSString*\u003e* tags = [labels getTags];\nNSSet\u003cNSNumber*\u003e* colorValues = [labels getColorValues];\n\n[labels addColorWithIndex:DSFFinderLabelsColorIndexBlue];\n\n...\n\nNSError* error = nil;\n[fileUrl setFinderLabelsWithFinderLabels:labels error:\u0026error];\n```\n\n\n### Add a color and tag to a file\n\n```swift\nlet url = URL(string: \"file:///Users/blah/Desktop/file.txt\")!\n\nlet labels = url.finderLabels()\n\n// Add a new color\nlabels.colors.insert(.red)\n\n// Add a new tag\nlabels.tags.insert(\"Completed\")\n\n// And update the file and some others with the new label(s) and color(s)\ndo {\n   try url.setFinderLabels(labels)\n}\ncatch {\n   print(error)\n}\n```\n\n### Retrieve finder standard colors and their indexes\n\n```swift\nlet colors = DSFFinderLabels.FinderColors\n\n// colors.colors[0] = { .none, \"None\", \u003cnone color\u003e }\n// colors.colors[1] = { .gray, \"Gray\", \u003cgray color\u003e }\n// colors.colors[2] = { .green, \"Green\", \u003cgreen color\u003e }\n// ...\n```\n\n## Demo screenshot\n\n![](https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/DSFFinderLabels/finder-labels.gif?raw=true)\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2019 Darren Ford\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsffinderlabels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fdsffinderlabels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsffinderlabels/lists"}