'Why is the bundle for a Swift Package not found when using Bundle.module?
I'm building a Swift Package library that contains a text resource inside /swift-spk/Sources/SPK/Resources/names.txt. The resource is being copied into the target as:
.target(
name: "SPK",
dependencies: [],
resources: [
.copy("Resources/names.txt")
]),
... The Bundle.module accessor is generated and I use it in a private function within the Swift Package (the Bundle.module call is performed from within the Swift Package). I run the code within a Playground file and the runtime fails with an error message:
SPK/resource_bundle_accessor.swift:27: Fatal error: unable to find bundle named swift-spk_SPK
I'm following the guidelines I found on tutorials and similar questions from last year here so I'm curious if there have been any changes to the resource loading.
Thanks in advance for any support 😎
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
