Resource

    A resource to bundle with the Swift package.

    Resource.swift:36Resource.md
    SwiftPM
    5.3+
    struct Resource

    If a Swift package declares a Swift tools version of 5.3 or later, it can include resource files. Similar to source code, Swift Package Manager scopes resources to a target, so you must put them into the folder that corresponds to the target they belong to. For example, any resources for the MyLibrary target must reside in Sources/MyLibrary. Use subdirectories to organize your resource files in a way that simplifies file identification and management. For example, put all resource files into a directory named Resources, so they reside at Sources/MyLibrary/Resources.

    By default, Swift Package Manager handles common resources types for Apple platforms automatically. For example, you don’t need to declare XIB files, storyboards, Core Data file types, and asset catalogs as resources in your package manifest. However, you must explicitly declare other file types — for example, image files — as resources using the process(_:localization:) or copy(_:) rules. Alternatively, exclude resource files from a target by passing them to the target initializer’s exclude parameter.

    To learn more about package resources, see bundling-resources-with-a-swift-package.

    Applying Rules

    See also

    Citizens in PackageDescription

    Type members