Finding unused files in Xcode

前端 未结 6 943
生来不讨喜
生来不讨喜 2021-02-18 18:52

I\'ve recently started work on a new app which is basically a copy of a previous app I made, with a few changes. To make this new app I\'ve copied the old app and removed some s

6条回答
  •  忘了有多久
    2021-02-18 19:14

    There isn't any functionality like this built into Xcode, but the issue of unused classes/files etc isn't as simple as one may think.

    People have created scripts to try and determine unused files. I have used the script located here, which searches through all your source files, and tries to pair up the resource files. The script also tries to check for source files not included within your project.

    The reason its not so trivial is that Obj-C is a very dynamic language; a lot of things are determined at run-time. As such, it sometimes can be tricky to figure out unused files statically. For example, an image name might be determined on the fly depending on user input.

    I don't know how big your application is, but you could try a dependency graph, and check for orphan classes. See this blog post on some more information.

提交回复
热议问题