embedInCode(_:)
Applies the embed rule to a resource at the given path.
Declaration
static func embedInCode(_ path: String) -> ResourceParameters
- path:
The path for a resource.
Return Value
A Resource instance.
Discussion
Use the embed rule to embed the bytes that represent the contents of a resource into executable code. For example, if you embed the file identifier.txt that has the contents:
Hello SwiftPackage manager generates a PackageResources class with each embedded resource as a static property based on the name of the resource. For the example above, the code generated by Package Manager is equivalent to the following source:
struct PackageResources {
static let identifier_txt: [UInt8] = [72,101,108,108,111,32,83,119,105,102,116,10]
}