4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcodeで使っていない画像を一覧表示するライブラリを使うと便利

Last updated at Posted at 2020-06-18

前提

Xcodeで未使用、不使用、使っていない画像リソースを削除するライブラリないかなーと探していたら以下の記事を発見。

Unused images and resources clean up in Xcode - SwiftLee
https://www.avanderlee.com/optimization/unused-images-clean-up/

  • FengNiao
  • LSUnusedResources

の2つのライブラリがあって、それぞれ試してみたけどFengNiaoのほうが良さげだったらしい。
なので、今回はFengNiaoを使って使っていない画像ファイルのあぶり出しを行うことに。

FengNiao使い方

onevcat/FengNiao: A command line tool for cleaning unused resources in Xcode.
https://github.com/onevcat/FengNiao

git clone https://github.com/onevcat/FengNiao.git
cd FengNiao
./install.sh

あとは調査したいプロジェクトのディレクトリに入ってfengniaoコマンドを実行するだけ。
かんたん。

実際にやってみた

以下のコマンドを実行すると

fengniao --project . --exclude Carthage Pods fastlane
スクリーンショット 2020-06-18 17.42.22.png

使ってなさそうなファイル一覧が出てくるので、念の為プロジェクト側で検索して使っていないか確認しつつ消していく

おまけ

SwiftGenを使っているとすべての画像ファイルが自動で参照されてしまうので、SwiftGenによってGenerateされたファイルを消してからfengniaoコマンドを実行するとそれっぽいファイルが出てくる。ただし、コードから参照している可能性があるので、1つ1つ使っていないかの確認が必要😇

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?