Development Assets in Xcode that allow developers to provide test data to use within SwiftUI previews and other code during development. Assets marked for development will only be included in debug builds and removed once you create an archive of your app. This solution is preferred to having larger assets in the production binary size. Developers can add different types of data as Development Assets, such as JSON files for mocked network requests, images to use in SwiftUI previews, Core Data sample databases, and Swift files representing mocked or sample data. Swift files are added differently because they use the dead code stripper to avoid the compiler from failing during archiving.

To define development assets through the XcodeGen config file, use DEVELOPMENT_ASSET_PATHS:

name: MySampleApp
options:
  bundleId: com.example.MySampleApp
  deploymentTarget: 14.0
  organizationName: Example, Inc.
  developmentLanguage: swift
  useTabs: true
  indentWidth: 4
  tabWidth: 4
  swiftVersion: 5.5
  carthageBuildPath: Carthage/Build/iOS

targets:
  - name: MySampleApp
    type: application
    platform: iOS
    deploymentTarget: 14.0
    sources: 
      - path: MySampleApp
    settings:
      ENABLE_BITCODE: NO
      SWIFT_OPTIMIZATION_LEVEL: -Onone
      SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEBUG
      DEVELOPMENT_ASSET_PATHS: 
         Dashboard/PreviewAssets
         List/Views/PreviewAssets
// ...

Resources