SwiftPM 5.9 introduced an embedInCode
rule.
The feature wasn't pitched or reviewed (as far as I know), and there's an open issue for type checking of larger resources.
It also uses Array
rather than InlineArray
, unlike the recently pitched Compile-Time Values and Section Placement Control.
For example, if your package manifest contains:
let package = Package(
name: "…",
products: […],
targets: [
.target(
name: "…",
resources: [.embedInCode("Example.txt")],
then a derived embedded_resources.swift
file will contain:
struct PackageResources {
static let Example_txt: [UInt8] = […]
}