From a6622dcbde526954058ecb6f5360262eab30cf41 Mon Sep 17 00:00:00 2001 From: Joe Heck Date: Wed, 8 Oct 2025 13:17:48 -0700 Subject: [PATCH 1/2] extending the docs to explain how to use embedInCode --- .../Runtimes/PackageDescription/Resource.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Sources/Runtimes/PackageDescription/Resource.swift b/Sources/Runtimes/PackageDescription/Resource.swift index 17ebcff0283..a4f748e3f5a 100644 --- a/Sources/Runtimes/PackageDescription/Resource.swift +++ b/Sources/Runtimes/PackageDescription/Resource.swift @@ -97,7 +97,20 @@ public struct Resource: Sendable { /// Applies the embed rule to a resource at the given path. /// - /// You can use the embed rule to embed the contents of the resource into the executable code. + /// Use the embed rule to embed the bytes that represents the contents of a resource into executable code. + /// For example, if you embed the file `identifier.txt` that has the contents: + /// ``` + /// Hello Swift + /// ``` + /// + /// Package 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] + /// } + /// ``` + /// /// - Parameter path: The path for a resource. /// - Returns: A `Resource` instance. @available(_PackageDescription, introduced: 5.9) From 9295b2025d913d852ed32bd51d099c5b11473fdc Mon Sep 17 00:00:00 2001 From: Joseph Heck Date: Thu, 9 Oct 2025 08:39:31 -0700 Subject: [PATCH 2/2] Update Sources/Runtimes/PackageDescription/Resource.swift Co-authored-by: Bri Peticca --- Sources/Runtimes/PackageDescription/Resource.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Runtimes/PackageDescription/Resource.swift b/Sources/Runtimes/PackageDescription/Resource.swift index a4f748e3f5a..2271e17b49f 100644 --- a/Sources/Runtimes/PackageDescription/Resource.swift +++ b/Sources/Runtimes/PackageDescription/Resource.swift @@ -97,7 +97,7 @@ public struct Resource: Sendable { /// Applies the embed rule to a resource at the given path. /// - /// Use the embed rule to embed the bytes that represents the contents of a resource into executable code. + /// 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 Swift