I'm working on an AppIcon selector and would like to do something like UIImage(named: "AppIcon-Alternate")
to present the icon for the user to choose using the new IconComposer icons.
I've done a fair bit of research on this and it looks like this used to be possible (prior to .icon) with workarounds that were later 'fixed' / removed (appending 60x60 to the icon name).
The only 'solution' seems to be bundling the exported images into the app itself but this seems like a terrible idea as it massively bloats the app. Assuming we export from the new IconComposer tool and want to include dark mode that's roughly 3MB per icon which is absolutely shocking bloat and so a terrible solution.
Looking into the app the Assets.car actually generates png files for these alternate icons. These are in the json as "MultiSized Image" assets. Interestingly using UIImage(named:
is actually attempting to load these but fails to resolve an kCSIElementSignature
. Also the OS alert when switching alternate icon shows a preview of the icon so this must be privately possible and using Asset Catalog Tinkerer I'm able to see these pngs.
This feels like broken API; I'd guess the new icon format is not correctly generating the entry in the Asset.car to link the generated pngs for usage with UIImage(named:)
API.
Does anyone have pointers for this? This feels like a developer API afterthought or bug but is it intentional?
Edit: I've submitted feedback for this FB20341182
.