You use asset catalogs to organize and manage the different asset types and image resolutions used by your app’s user interface. In particular, use asset catalogs to manage images that are required to launch your app on a device and submit your app to the App Store.
You can have multiple asset catalogs in your project and within each catalog, multiple sets of assets. In addition, you can organize sets into folders.The common types of sets you can add to a catalog are image, data, and texture sets. You group different variations of an image into an image set to support multiple device configurations. Similarly use a data set to group variations of data files for different device configurations. There are also templates for adding platform and app service-specific assets to a catalog.
If you create your project from a template, the project contains a default Assets catalog containing an AppIcon image set and possibly others depending on the type of app. The image sets contain placeholders for variations of images that you should provide before distributing your app. For example, an app icon is required to distribute your app through the App Store.
In the Project navigator, select an asset catalog (a file with a .xcassets
file extension) and the asset catalog appears in the editor area. The image sets and folders appear in the outline view on the left and the assets for the selected set appear in the detail area on the right. The inspector for the selected set or asset appears in the utilities area.
For apps targeting iOS 9 and later, the asset catalog can be used to edit on-demand resource tags and attributes used in slicing.
You can share asset catalogs across multiple projects in the same workspace.
Add a new file from a template and in the sheet under Resource, select Asset Catalog and click Next. The new asset catalog will appear in the Project navigator and open in the editor area.
In the Project navigator, select the project and in the project editor, select the target.
Choose the target from the Project/Targets pop-up menu or in the Targets section of the outline view if it appears.
In the “App Icons…” section of the General pane, choose the app icon set from the App Icons Source pop-up menu.
If you create your project from a template, the default asset catalog contains the required app icon image set.
Click the arrow button next to the pop-up menu.
The associated asset catalog opens in the editor area. The app icon set is selected in the outline view, and wells for the different variations appear in the detail area.
For tvOS apps, open the App Icon & Top Shelf Image folder to reveal the different app icon and launch image sets.
In the Finder, drag variations of the app icon to the wells in the detail area that match their resolutions.
Alternatively, select the asset catalog containing the app icon set in the Project navigator and drag variations to the wells. You can also add app icons by selecting an asset catalog, and then choosing Editor > Add Assets > Import.
In the Project navigator, select the asset catalog.
In the Finder, drag an image to the outline view.
A new image set appears in the outline view and the asset appears in a well in the detail area.
Drag other variations of the image to the wells in the detail area that match their resolutions.
To create other types of image sets:
Create an empty image set: Choose New Image Set from the Add button (+) or from the Editor > Add Assets menu.
Create an app icon set: Choose App Icons & Launch Images > New [OS] App Icon from the Add button (+) or from the Editor > Add Assets menu. For an iOS app, choose New iOS App Icon and for a tvOS app, choose New tvOS App Icon and Top Shelf Image.
Create an iOS or tvOS launch screen image set: Choose App Icons & Launch Images > New [OS] Launch Image from the Add button (+) or from the Editor > Add Assets menu. For an iOS app, you can also change the default launch screen source to an image set.
In the Project navigator, select the asset catalog.
Drag a data file from the Finder to the outline view.
A new data set appears in the outline view containing the data file.
Drag other variations of the data file from the Finder to the appropriate well in the detail area.
Alternatively, to create an empty data set, choose New Data Set from the Add button (+) menu at the bottom of the outline view, or choose Editor > Add Assets > Import.
In the Project navigator, select the asset catalog.
In the outline view, select the assets you want to add to a folder.
Click the Add button (+) at the bottom of the outline and choose "New Folder from Selection" from the pop-up menu.
The new folder containing the selected items appears in the outline view.
Alternatively, at the bottom of the outline view, choose New Folder from the pop-up menu and drag the assets to the folder.