![]() Replace this Contents.json file with a corrected Contents.json file.Right-click on the App Icon, and select Show in Finder.Select all of the files you’ve generated ( except for this file is no longer included in the app icon package) and drag them as per usual into the App Icon in the Assets Catalog in Xcode.So, as a recap, here are the steps to follow after generating your icon files from Photoshop: If we’ve used the Photoshop template, our files will have the same names every time, so we can simply replace the Contents.json with a standard Contents.json file that has been set up with the correct description of the files, and everything should automatically drop into the correct wells! So all the files we need are in the AppIcon folder in the Assets Catalog, we just need them to be assigned correctly in the Contents.json file. Here’s the magic! The Contents.json is a file used by the asset catalog to describe its assets (or folders, metadata, etc.) If you open the Contents.json file for the AppIcon you’ll find that it describes all of the app icon files, blank wells and unassigned images, something like this: Here you’ll find all of the icon files inside the project, along with a ‘Contents.json’ file: So, if you right-click on the app icon in the asset catalog, and select ‘Show in Finder’: Boring! We want automation! Fix the automation So – of course one solution is to resolve this manually, by dragging files one by one into their correct wells. But maybe a more pertinent question is… What to do about this? Fix it manually My guess is this is a bug in Xcode, if anyone has more info on this feel free to add a comment here. Only some wells fill, others stay blank, and some files are treated as unassigned: However, as we saw, when you drag these icons into your app icon: ![]() Once you’ve set up your icon, you can specify File > Generate > Image Assets:Īnd this will output all the files you’ll need to create an app icon: ![]() Generating App Icon filesįirst, how to set up all of these versions of the app icon?Įasy! Apple provides a Photoshop (or Sketch or Adobe XD) template in the resources section of HIG for setting up an icon, that looks something like: There is some automation there, but weirdly it’s a bit hit and miss. So you’d think it would be just as easy to set up an app icon in the asset catalog. You just need to give each the three scale factor image files the correct syntax, something like:ĭrag them in and Xcode automatically detects the correct well for each image, and tada! When you create an image set in Xcode, it’s so easy to automatically fill the wells for each scale factor.
0 Comments
Leave a Reply. |