Skip to content

Commit 80a42a4

Browse files
Vitor Silveirastackotter
authored andcommitted
#194: Clarify example execution steps and recommend Swift Bundler
1 parent 497597f commit 80a42a4

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,48 @@ struct CounterApp: App {
8181
}
8282
```
8383

84-
Clone the SwiftCrossUI repository to test out this example, and many more;
84+
Clone the SwiftCrossUI repository to test out this example and others. Running the examples requires an installation of [Swift Bundler](https://github.com/stackotter/swift-bundler), which provides consistent behavior across platforms and enables running on iOS and tvOS simulators and devices.
85+
86+
To install Swift Bundler, you can follow [its official installation instructions](https://github.com/stackotter/swift-bundler?tab=readme-ov-file#installation-). Swift Bundler is typically installed using [Mint](https://github.com/yonaskolb/Mint?tab=readme-ov-file#installing), a Swift package manager that lets you easily install and run CLI tools distributed as Swift packages.
87+
88+
If you don't have Mint installed, you can install it with [Homebrew](https://brew.sh/):
8589

8690
```sh
87-
git clone https://github.com/stackotter/swift-cross-ui
88-
cd swift-cross-ui/Examples
89-
swift run CounterExample
91+
brew install mint
9092
```
9193

92-
The examples are written as Swift packages, which means you can't run them on iOS directly without creating an Xcode project. By using tools like [`mint`](https://github.com/yonaskolb/Mint) and [`swift-bundler`](https://github.com/stackotter/swift-bundler), running these apps on the iOS Simulator becomes much easier.
94+
Then use Mint to install Swift Bundler:
9395

9496
```sh
95-
brew install mint
9697
mint install stackotter/swift-bundler@main
98+
```
99+
100+
Once installed, clone the project and run the example:
101+
102+
```sh
97103
git clone https://github.com/stackotter/swift-cross-ui
98104
cd swift-cross-ui/Examples
99-
swift bundler run CounterExample --simulator "iPhone"
105+
swift bundler run CounterExample
100106
```
101107

108+
You can also run on iOS and tvOS:
109+
110+
```sh
111+
# On a connected device with "iPhone" in its name (macOS only)
112+
swift bundler run CounterExample device iPhone
113+
114+
# On a simulator with "iPhone 16" in its name (macOS only)
115+
swift bundler run CounterExample simulator "iPhone 16"
116+
```
117+
118+
These examples may also be run on your host machine without Swift Bundler by using SwiftPM:
119+
120+
```sh
121+
swift run CounterExample
122+
```
123+
124+
However, resources may not be loaded as expected, and features like deep linking may not work. This method also does not support running on iOS or tvOS.
125+
102126
The documentation contains [a detailed list of all examples](https://stackotter.github.io/swift-cross-ui/documentation/swiftcrossui/examples)
103127

104128
## Backends

0 commit comments

Comments
 (0)