NullHypothesis
NullHypothesis

Reputation: 4506

Using XCAssets Properly (adding assets)

I had two people discuss two different approaches with me on how to add assets such as images to a project in Swift.

  1. Person 1: "You should create a new folder within your actual project workspace and then add all of your assets to it directly (so it's within the project). Then drag & drop the assets from this project folder to XCAssets, to actually create the icons you will use."
  2. Person 2: "Just download your images from wherever, and drag and drop them directly. They can be from different locations. When you deploy to ITunesConnect it will copy the images."

Now I'm confused - when I drag and drop an image (let's say from my Downloads folder) doesn't Xcode copy the image locally into its own private location? Once I drag it into XCAssets, does it need that source location anymore? I thought maybe approach #1 would end up forcing Xcode to store duplicate images/assets and take up more size on the app.

What is the "correct" approach to adding assets?

Thanks!

Upvotes: 0

Views: 793

Answers (1)

GeneCode
GeneCode

Reputation: 7588

Both actually can work (drag and drop/use asset folder). But the latest method introduced by Apple by xcasset folder. XCAsset folder is superior in the way that you can see a list of assets nicely one by one, even you have multiple sizes on it (.png @2x.png @3x.png etc). Easier to manage and see which size you are missing etc.

Upvotes: 0

Related Questions