Skip to content

Commit f284bbb

Browse files
authored
Update docs on SwiftPM integration.
Differential Revision: D66827099 Pull Request resolved: #7216
1 parent 3ea5b77 commit f284bbb

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

docs/source/apple-runtime.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The prebuilt ExecuTorch runtime, backend, and kernels are available as a [Swift
2525

2626
#### Xcode
2727

28-
In Xcode, go to `File > Add Package Dependencies`. Paste the URL of the [ExecuTorch repo](https://github.com/pytorch/executorch) into the search bar and select it. Make sure to change the branch name to the desired ExecuTorch version in format "swiftpm-<version>", (e.g. "swiftpm-0.4.0"), or a branch name in format "swiftpm-<version>.<year_month_date>" (e.g. "swiftpm-0.4.0-20241114") for a nightly build on a specific date.
28+
In Xcode, go to `File > Add Package Dependencies`. Paste the URL of the [ExecuTorch repo](https://github.com/pytorch/executorch) into the search bar and select it. Make sure to change the branch name to the desired ExecuTorch version in format "swiftpm-<version>", (e.g. "swiftpm-0.4.0"), or a branch name in format "swiftpm-<version>.<year_month_date>" (e.g. "swiftpm-0.4.0-20241201") for a nightly build on a specific date.
2929

3030
![](_static/img/swiftpm_xcode1.png)
3131

@@ -44,24 +44,30 @@ Click the screenshot below to watch the *demo video* on how to add the package a
4444
Add a package and target dependencies on ExecuTorch to your package file like this:
4545

4646
```swift
47-
// swift-tools-version:5.0
47+
// swift-tools-version:5.9
4848
import PackageDescription
4949

5050
let package = Package(
5151
name: "YourPackageName",
52+
platforms: [
53+
.iOS(.v17),
54+
.macOS(.v10_15),
55+
],
5256
products: [
5357
.library(name: "YourPackageName", targets: ["YourTargetName"]),
5458
],
5559
dependencies: [
56-
// Use "swiftpm-0.4.0.<year_month_day>" branch name for a nightly build.
57-
.package(url: "https://github.com/pytorch/executorch.git", .branch("swiftpm-0.4.0"))
60+
// Use "swiftpm-<version>.<year_month_day>" branch name for a nightly build.
61+
.package(url: "https://github.com/pytorch/executorch.git", branch: "swiftpm-0.4.0")
5862
],
5963
targets: [
6064
.target(
6165
name: "YourTargetName",
6266
dependencies: [
6367
.product(name: "executorch", package: "executorch"),
64-
.product(name: "xnnpack_backend", package: "executorch")
68+
.product(name: "backend_xnnpack", package: "executorch"),
69+
.product(name: "kernels_portable", package: "executorch"),
70+
// Add other backends and kernels as needed.
6571
]),
6672
]
6773
)

0 commit comments

Comments
 (0)