|
1 |
| -The `skip` plugin for Xcode transpiles Swift packages into Kotlin projects. |
| 1 | +The Skip plugin for Xcode transpiles Swift SPM packages into Kotlin Gradle projects. |
2 | 2 |
|
3 | 3 | ## Quick Start
|
4 | 4 |
|
5 |
| -1. Create a new Swift package from Xcode.app 14.3+ with `File -> New -> Package`, |
6 |
| -and name it "MyLibrary". |
| 5 | +1. Create a new Swift package from Xcode.app 14.3+ with `File -> New -> Package`. |
7 | 6 | <details><summary>Creating a new Multiplatform Swift Package</summary><img width="1512" alt="skip-onboard-01" src="https://user-images.githubusercontent.com/659086/230632488-8bf87042-59ba-48aa-9108-71efdea5d9bb.png"></details>
|
| 7 | + This example name the new package “MyLibrary” and save it to the Desktop, but the package can be named anything. |
8 | 8 |
|
9 |
| - |
10 |
| -1. Select the `Package.swift` file and append the following lines to activate the Skip transpiler plugin: |
| 9 | +1. Select the new `Package.swift` file in Xcode and add the following lines to activate the Skip transpiler plugin: |
11 | 10 | ```swift
|
12 | 11 | package.dependencies += [.package(url: "https://github.com/skiptools/skip", from: "0.3.15")]
|
13 | 12 | package.dependencies += [.package(url: "https://github.com/skiptools/skiphub", from: "0.1.2")]
|
14 | 13 | ```
|
15 |
| - After saving the file, Xcode will download and install the Skip packages so they appear in the project navigator. |
16 | 14 | <details><summary>Adding the Skip plugin to Xcode</summary><img width="1578" alt="skip-onboard-01" src="https://user-images.githubusercontent.com/659086/230633291-e14e5687-a88d-4bc9-abbd-b78e9fa73c61.png"></details>
|
| 15 | + After saving the file Xcode will download and install the Skip plugin and dependencies so they appear in the project navigator. |
17 | 16 |
|
18 | 17 |
|
19 |
| -1. Select your package's root folder in the Xcode Project Navigator |
20 |
| -and select "Hello Skip" from the "skip" section of the package's |
21 |
| -context menu. |
22 |
| -Alternatively, from the terminal your can run the command |
23 |
| -`swift package plugin skip-init` from the project directory. |
| 18 | +1. Bring up the package's context menu in the Xcode Project Navigator and select "Hello Skip" from the "skip" section of the menu. |
24 | 19 | <details><summary>Initializing the package with Hello Skip</summary><img width="1512" alt="skip-onboard-02" src="https://user-images.githubusercontent.com/659086/230634103-37894206-f417-4a01-a149-ddab5dcb0780.png"></details>
|
| 20 | + (alternatively, from the terminal your can run the command `swift package skip-init` from the project directory.) |
25 | 21 |
|
26 |
| - |
27 |
| -1. When prompted to select the targets, you can choose which individual |
28 |
| -targets should have transpilation peer targets created for them. |
29 |
| -Leaving the default item selected will add all the valid targets. |
| 22 | +1. A dialog with the package and individual targets will appear. |
30 | 23 | <details><summary>Skip Target Selection Dialog</summary><img width="1512" alt="skip-onboard-03" src="https://user-images.githubusercontent.com/659086/230633675-27ff1c95-eab5-4139-b22c-01abc2b5a7ea.png"></details>
|
| 24 | + Leave the default package item selected to transpile all the valid targets. |
31 | 25 |
|
32 | 26 | 1. An overview of the plugin will be shown describing the actions that will be taken and prompting for permission to save files to the project directory.
|
33 | 27 | <details><summary>The Skip Overview Dialog</summary><img width="1578" alt="skip-onboard-04" src="https://user-images.githubusercontent.com/659086/230633804-3dd8504e-38c7-45e0-9c67-0edc60586064.png"></details>
|
| 28 | + Select the “Allow Command to Change Files” button to proceed. |
34 | 29 |
|
35 | 30 | 1. Once the plugin has completed, new targets will be appended to the end of the `Package.swift` file.
|
36 | 31 | You can run the test cases by selecting `MyLibrary-Package` running on `My Mac`.
|
37 | 32 | Successful transpilation and test case runs will show up in the log.
|
38 |
| -Note that the Kotlin test cases must be run against the macOS target, |
39 |
| -and Gradle must be installed on the machine (e.g. with: `brew install gradle` |
40 |
| -or from https://gradle.org). |
41 | 33 | <details><summary>Running the transpiled Kotlin test cases</summary><img width="1412" alt="skip-init-screenshot-2" src="https://user-images.githubusercontent.com/659086/229834667-f2939738-d21a-4814-94a1-63e316ca2dc5.png"></details>
|
| 34 | + Note: the Kotlin test case must be run against the macOS (rather than iOS), and Gradle must be installed on the machine with the homebrew (https://brew.sh) command: `brew install gradle` |
42 | 35 |
|
43 |
| -1. Test failures will be reported for both the failed Swift test cases, |
44 |
| -as well as the transpiled Kotlin JUnit tests. |
45 |
| -For example, if we change the assertion from "*Hello* World" to "*Goodbye* World", |
46 |
| -the two failed Swift XCTest and Kotlin JUnit tests can each be seen. |
| 36 | +1. Test failures will be reported for both the failed Swift test cases, as well as the transpiled Kotlin JUnit tests. |
| 37 | +For example, if we change the assertion from "*Hello* World" to "*Goodbye* World", the two failed Swift XCTest and Kotlin JUnit tests can each be seen. |
47 | 38 | <details><summary>Browing the Swift XCTest failure report</summary><img width="1412" alt="skip-init-screenshot-3" src="https://user-images.githubusercontent.com/659086/229835265-54970fce-70f4-45fc-ba8a-899c59559486.png"></details>
|
48 | 39 | <details><summary>Browing the Kotlin JUnit failure report</summary><img width="1412" alt="skip-init-screenshot-4" src="https://user-images.githubusercontent.com/659086/229835288-9c78eff2-cef1-4eb9-bf77-6f908a2281d0.png"></details>
|
0 commit comments