{"id":3181,"url":"https://github.com/onevcat/FengNiao","last_synced_at":"2025-08-03T13:32:12.520Z","repository":{"id":37445007,"uuid":"84144167","full_name":"onevcat/FengNiao","owner":"onevcat","description":"A command line tool for cleaning unused resources in Xcode.","archived":false,"fork":false,"pushed_at":"2024-01-23T14:06:23.000Z","size":462,"stargazers_count":3407,"open_issues_count":27,"forks_count":235,"subscribers_count":53,"default_branch":"master","last_synced_at":"2024-11-28T17:06:50.459Z","etag":null,"topics":["cleanup","command-line-tool","images","resources","slim","swift","xcode"],"latest_commit_sha":null,"homepage":null,"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/onevcat.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}},"created_at":"2017-03-07T02:20:20.000Z","updated_at":"2024-11-26T11:47:41.000Z","dependencies_parsed_at":"2023-09-27T03:38:02.222Z","dependency_job_id":"4950899f-8440-4ce2-8565-a88f5ccd84a2","html_url":"https://github.com/onevcat/FengNiao","commit_stats":{"total_commits":97,"total_committers":18,"mean_commits":5.388888888888889,"dds":"0.31958762886597936","last_synced_commit":"147289affddbdedb01fc220e723b01d9b78d0655"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FFengNiao","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FFengNiao/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FFengNiao/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FFengNiao/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onevcat","download_url":"https://codeload.github.com/onevcat/FengNiao/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228548567,"owners_count":17935221,"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":["cleanup","command-line-tool","images","resources","slim","swift","xcode"],"created_at":"2024-01-05T20:16:33.729Z","updated_at":"2025-08-03T13:32:12.491Z","avatar_url":"https://github.com/onevcat.png","language":"Swift","funding_links":[],"categories":["Tools","Swift","WebSocket"],"sub_categories":["Web View","Other free courses"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/onevcat/FengNiao/assets/logo.png\" alt=\"FengNiao\" title=\"FengNiao\" width=\"468\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/onevcat/FengNiao\"\u003e\u003cimg src=\"https://img.shields.io/travis/onevcat/FengNiao/master.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/swift-4.0+-brightgreen.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/SPM-ready-orange.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://raw.githubusercontent.com/onevcat/Kingfisher/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/l/Kingfisher.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://swift.org/package-manager/\"\u003e\u003cimg src=\"https://img.shields.io/badge/platform-macos%20|%20Linux-blue.svg\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/onevcat/Hedwig\"\u003e\u003cimg src=\"https://codecov.io/gh/onevcat/Hedwig/branch/master/graph/badge.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What\n\nFengNiao is a simple command-line util to delete unused image resource files from your Xcode project.\n\n## How\n\n### Install\n\n#### Mint\n\n[Mint](https://github.com/yonaskolb/Mint) is a tool that installs and runs Swift command line tool packages. Make sure\nyou have Xcode installed, then:\n\n```sh\n\u003e brew install mint\n\u003e mint install onevcat/fengniao\n```\n\n#### Compile from source\n\n```bash\n\u003e git clone https://github.com/onevcat/FengNiao.git\n\u003e cd FengNiao\n\u003e swift build -c release\n\n# Then copy the executable to your PATH, such as `/usr/local/bin`\n\u003e sudo cp .build/release/FengNiao /usr/local/bin/fengniao\n```\n\nFengNiao should be compiled, tested and installed into the `/usr/local/bin`.\n\n### Usage\n\nJust navigate to your project folder, then:\n\n```shell\n\u003e fengniao\n```\n\nIt will scan current folder and all its subfolders to find unused images, then ask you whether you want to delete them. Please make sure you have a backup or a version control system before you deleting the images; it will be an un-restorable operation.\n\nFengNiao supports some arguments. You can find it by:\n\n```shell\n\u003e fengniao --help\n\n  -p, --project:\n      Root path of your Xcode project. Default is current folder.\n  --force:\n      Delete the found unused files without asking.\n  -e, --exclude:\n      Exclude paths from search.\n  -r, --resource-extensions:\n      Resource file extensions need to be searched. Default is 'imageset jpg png gif pdf'\n  -f, --file-extensions:\n      In which types of files we should search for resource usage. Default is 'm mm swift xib storyboard'\n  --skip-proj-reference:\n      Skip the Project file (.pbxproj) reference cleaning.\n      By skipping it, the project file will be left untouched. \n      You may want to skip ths step if you are trying to build multiple projects with dependency and keep .pbxproj unchanged while compiling.\n  --xcode-warnings:\n      Print results as xcode warnings and return non zero code if any.\n  --list-only:\n      List unused files and exit without prompting.\n  --version:\n      Print version.\n  -h, --help:\n      Print this help message.\n```\n\nA more daily-work usage under a project could be:\n\n```shell\n\u003e fengniao --project . --exclude Carthage Pods\n```\n\nThis will search in current folder, but skip the `Carthage` and `Pods` folder, in which there might be some third party resources you do not want to touch.\n\n### Use with Xcode build phase\n\nIt is easy to integrate FengNiao into your Xcode build process. By doing so, you could ensure your project being cleaned every time you build your project. \n\nAdd a \"Run Script\" phase in the Build Phases tab:\n\n![](http://i.imgur.com/Un8oYx7.png)\n\nThen drag it above of \"Copy Bundle Resources\", editing its content to something like this:\n\n```bash\nfengniao --exclude Carthage --force\n```\n\nIt is recommended to exclude vendor's folders like Pods or Carthage. Since you do not have a chance to confirm the result, you also need to add `--force` option.\n\n### App Version\n\nAn GUI app version of FengNiao is also available. You can find it under the [App folder](https://github.com/onevcat/FengNiao/tree/master/App). We do not provide a pre-built binary for it. If needed, please build it by yourself. Thank you for @ldakhoa's contribution!\n\n![](https://github.com/onevcat/FengNiao/assets/1019875/fef5874b-b114-42c6-9ce5-0420460180ab)\n\n## How it works\n\n1. Extract resource file names (default file type: `[\"imageset\", \"jpg\", \"png\", \"gif\", \"pdf\"]`) in these folders `[\"imageset\", \"launchimage\", \"appiconset\", \"bundle”]`.\n2. Use regular expression to search all string names in files (default files type: `[\"m\", \"mm\", \"swift\", \"xib\", \"storyboard\", \"plist\"]`).\n3. Exclude all used string names from resources files, we get all unused resources files.\n\n\n## License and Information\n\nFengNiao is open-sourced as MIT license. The name of this project comes from the Chinese word 蜂鸟 (hummingbird), which is the smallest bird in the world.\n\nSubmit [an issue](https://github.com/onevcat/FengNiao/issues/new) if you find something wrong. Pull requests are warmly welcome, but I suggest to discuss first.\n\nYou can also follow and contact me on [Twitter](http://twitter.com/onevcat) or [Sina Weibo](http://weibo.com/onevcat).\n\n## Learning to Create\n\nI streamed the way I created this tool as a live-coding session in a live platform in China. You can learn how to create a project with Swift Package Manager, how to apply Protocol-Oriented Programming (POP) in the project, and how to develop in a BDD way as well as write good tests there. \n\nIt is a paid series lesson in Chinese. If you are interested in it, please check and watch the links below:\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevcat%2FFengNiao","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonevcat%2FFengNiao","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevcat%2FFengNiao/lists"}