Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of xcassets

Tags:

xcode5

xcasset

Is .xcassets resource only for app icons and launch images or for our own image assets also? I do know that we can add our images to the .xcassets file, but is it good practice to do so?

like image 767
Roshan Avatar asked Oct 18 '13 05:10

Roshan


People also ask

What is Xcassets?

xcassets Catalog in Xcode. An asset catalog, simply put, is a single folder in Xcode that you use to organize your app's images, icons, colors, and more. Instead of adding individual images to Xcode's file organizer, you add assets neatly organized in a single catalog.

What is images Xcassets?

The images. xcassets catalog is the default asset, used to manage the required app icons and launch images.

How do I add an asset catalog in Xcode?

If you don't already have an asset catalog in your project, you can create one by right-click on your project and choosing New File. From "iOS" choose "Resource" then Asset Catalog, then click Next and name your catalog. You can now select your new asset catalog in Xcode, and drag pictures directly into it.


2 Answers

Use of xcassets is the new standard as of Xcode 5 and iOS 7. Import images by clicking on the blue folder called "Images.xcassets" then click on the small "+" plus sign at the bottom of the window that appears. Now choose "Import" to put images in there.

This is also the new location of the icon and launch images instead of the standard target->general location, although this is where you still have the option to not choose "Don't use asset catalogs".

It's really helpful because you'll only see 1 image name instead of duplicate names with extensions like "@2x" and "-568h@2x".

enter image description here

like image 70
Ethan Parker Avatar answered Sep 23 '22 03:09

Ethan Parker


Apple said that the asset catalog editor in Xcode manages your app’s images, grouping together various resolutions of the same asset. When building, Xcode compiles the asset catalog into the most efficient bundle for final distribution.

So basic asset catalog can manage AppIcon and LaunchImage.

enter image description here

But you can also add new images to new folders as below.

enter image description here

like image 28
Jordan Montel Avatar answered Sep 22 '22 03:09

Jordan Montel