23

What is the use of "Preview Assets" assets catalog in Xcode 11 beta?

XCode 11 Beta - Screenshot

I have just created new project with SwiftUI. I have checked release notes of Xcode 11 beta but there is no information about this assets catalog.

What is the use of it?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136

2 Answers2

23

Now, when you layout your views you can preview it in Canvas (the window from the right side of the code editor). Obviously, some images and other data for your app you can get only in runtime, from your API for example. So all stubs can be placed into Preview Content folder, in particular in Preview Assets

Argas
  • 1,427
  • 1
  • 10
  • 12
  • 19
    You can put resources in the standard assets folder and access them there for your previews as well, so this answer doesn't explain why the Preview Assets folder exists. The reason it exists is because it won't be bundled with your app in release builds. – Peter Schorn Jul 03 '21 at 00:23
  • 5
    The actual Build Setting is named "Development Assets" (`DEVELOPMENT_ASSET_PATHS`), its defined as a string list and you can put any paths in here which you want to have for development builds, but not in archive/install builds. – smat88dd Dec 08 '21 at 06:01
4

For more info about it:

The idea of it, it's to avoid releasing the files inside it into production. In that way you decrease the size of the build since they will be removed in the archive phase.

https://www.avanderlee.com/xcode/development-assets-preview-catalog/

Like @peterSchorn mentioned in the comment before mine

Md. Ibrahim Hassan
  • 5,359
  • 1
  • 25
  • 45
Sophy Swicz
  • 1,307
  • 11
  • 21