If the same file appears twice, Emerge flags it as a duplicate. In most cases you can delete the duplicate copies of the file to save size. In addition to duplicate files, resources in asset catalogs can also be flagged as duplicates.
In some cases you may need to use a resource from your main app and an embedded plugin, such as a Siri extension. If you have one copy of your files in the main app bundle and a second copy in a framework (used by the Siri extension), you can delete the copy in the main app and only reference the framework. Here’s an example of a typical file structure that will be flagged as duplicates:
In this case, you can delete the myImage.jpg from the root level
Update references to new bundles
If you remove a resource from the main bundle, make sure you update any code referencing this resource to load it from the framework’s bundle.
You can update code to load an image from a new bundle like this:
// Before: Loading from the main bundle:
let image = UIImage(named: "myImage")
// After: Loading from the framework bundle:
let image = UIImage(
in: Bundle(for TypeInFramework.self),
If you see localized strings files being marked as duplicates you may be able to delete one. For example if you have:
fr-CA is identical to the file in
fr, you can delete the
fr-CA variant and iOS will fallback to the closest matching version, in this case
Emerge suggests duplicate resource and asset candidates if the potential savings of removing one duplicate is over 0.5 kb.
Emerge detects if a file is a duplicate by checking a hash of the file contents. The file savings shown on each insight is the potential savings of removing all of the duplicated resource/asset files, keeping one remaining.
Emerge also shows duplicate files directly in the size treemap by coloring the respective file red, with the path and filename of the duplicate present in the tooltip when hovering over the file's node.
Updated over 1 year ago