{"id":28635950,"url":"https://github.com/webpatch/asset2enum","last_synced_at":"2025-08-17T14:06:42.148Z","repository":{"id":36358778,"uuid":"40663564","full_name":"webpatch/Asset2Enum","owner":"webpatch","description":"Automatic generate  swift enum based on xcassets file","archived":false,"fork":false,"pushed_at":"2015-08-14T01:59:11.000Z","size":204,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T09:50:07.521Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-13T14:35:55.000Z","updated_at":"2015-08-14T02:02:42.000Z","dependencies_parsed_at":"2022-09-06T03:50:39.563Z","dependency_job_id":null,"html_url":"https://github.com/webpatch/Asset2Enum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/webpatch/Asset2Enum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpatch%2FAsset2Enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpatch%2FAsset2Enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpatch%2FAsset2Enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpatch%2FAsset2Enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpatch","download_url":"https://codeload.github.com/webpatch/Asset2Enum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpatch%2FAsset2Enum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856775,"owners_count":24657700,"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-08-17T02:00:09.016Z","response_time":129,"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":[],"created_at":"2025-06-12T17:11:52.975Z","updated_at":"2025-08-17T14:06:42.124Z","avatar_url":"https://github.com/webpatch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asset2Enum\nAutomatic generate  enum based on `.xcassets` file\n\n![preview](https://raw.githubusercontent.com/webpatch/xcassets-enum-automatic-generator/master/preview/preview.jpg)\n\n## Enum file\nThe enum file `AssetImages.swift` will look like the following:\n\n```swift\nimport UIKit\nextension UIImage {\n\tenum Asset : String {\n\t\tcase Check = \"check\"\n\t\tcase List = \"list\"\n\t\tcase Back = \"back\"\n\t\tcase Backward = \"backward\"\n\t\tcase Forward = \"forward\"\n\t\tcase Full_Screen = \"full_screen\"\n\t\tcase Lock_Screen = \"lock_screen\"\n\t\tcase Mini_Screen = \"mini_screen\"\n\t}\n\n\tconvenience init!(asset: Asset) {\n\t\tself.init(named: asset.rawValue)\n\t}\n}\n```\n\nOnce the enum file generated and added to Xcode, you can use it like the following:\n\n```swift\nlet img1 = UIImage(asset: .Back)\nlet img2 = UIImage(asset: .Forward)\n```\n\n##Usage\n###Install (Once for all)\n1. Download the [xcassets.py](https://raw.githubusercontent.com/webpatch/xcassets-enum-automatic-generator/master/xcassets.py) and copy it to project's root directory (where the `.xcodeproj` file is located).\n\n2. Open terminal, `cd` to project's root directory, and excute the script in terminal:\n\n\t```shell\n\tpython xcassets.py -i\n\t```\n3. All done!\n\n\u003e When you change the `.xcassets` file, you need to rebuild the project first, and then it will automatic update the enum file.\n\n###Uninstall\n1. Delete the `AssetImages.swift` (choose `Move to Trash`) from Xcode.\n2. In project's `Build Phases` settings, delete the entry of `Auto generate xcassets enums`.\n3. Delete `xcassets.py`.\n\n##Script argument\n\n|arg|description|\n|---|---|\n|`-i`|init the script|\n|`-u`|update the enum file|\n|`-f`|force to update the enum file|\n|`-h`|help|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpatch%2Fasset2enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpatch%2Fasset2enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpatch%2Fasset2enum/lists"}