You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/docs/modes.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,8 +71,8 @@ The following diagram depicts a pure transpiled project:
71
71
72
72
Transpiled mode's advantages and disadvantages are mirror opposites of native mode's.
73
73
74
-
-**Integration with Android APIs**. The primary benefit of transpilation is near-perfect integration with Android's Kotlin and Java APIs. Because your Swift code is converted to Kotlin, it can [directly call other Kotlin API](/docs/platformcustomization/), just as if it were calling Swift. And because the Kotlin language features seamless integration with Java, your Swift code can call Java API as well. Unlike native mode, no [bridging](#bridging) is required.
75
-
-**Transparency**. Transpilation allows you to see and understand all of Skip’s output. Skip’s Kotlin is fully human-readable and even overridable: Skip includes the ability to [insert or substitute literal Kotlin](/docs/platformcustomization/#skip-comments) inline with your Swift. This is of particular use during [debugging](/docs/debugging/), where you get full stack traces and can take full advantage of Andriod's debugging tools to step through your generated Kotlin.
74
+
-**Integration with Android APIs**. The primary benefit of transpilation is near-perfect integration with Android’s Kotlin and Java APIs. Because your Swift code is converted to Kotlin, it can [directly call other Kotlin API](/docs/platformcustomization/), just as if it were calling Swift. We call this hybrid dialect [Kotlish](/docs/swiftsupport/#kotlish): syntactically Swift, but semantically Kotlin. And because the Kotlin language features seamless integration with Java, your Swift code can call Java API as well. Unlike native mode, no [bridging](#bridging) is required.
75
+
-**Transparency**. Transpilation allows you to see and understand all of Skip’s output. Skip’s Kotlin is fully human-readable and even overridable: Skip includes the ability to [insert or substitute literal Kotlin](/docs/platformcustomization/#skip-comments) inline with your Swift. This is of particular use during [debugging](/docs/debugging/), where you get full stack traces and can take full advantage of Andriod’s debugging tools to step through your generated Kotlin.
76
76
-**Ejectability**. If Skip were to disappear, transpiled mode still gives you the full source code to both the iOS and Android versions of your app. You could continue to evolve the app as separate iOS and Android codebases (which is how many dual-platform apps are developed). Skip does not have any required runtime components other than the libraries it uses to provide the Foundation, SwiftUI, etc APIs on Android, and these libraries are all [free and open-source](https://source.skip.tools).
77
77
-**App size**. Transpiled apps don't have to bundle anything but Skip's relatively slim compatibility libraries, while native apps have to include the much larger Swift Foundation and internationalization libraries.
78
78
-**Build time**. The combination of Skip's transpiler and the Android Kotlin compiler is faster than building with the full native Swift toolchain when iterating on your Android code.
@@ -327,7 +327,7 @@ See the [Bridging Support Reference](/docs/bridging/) for additional information
327
327
328
328
Skip offers multiple options for consuming Kotlin/Java API in native Swift. The most comprehensive is to bridge a transpiled Swift module.
329
329
330
-
Skip's ability to transpile Swift to Kotlin is one of its strengths. Transpiled Swift code effectively *is* Kotlin, which gives it a superpower: it can directly call any other Kotlin/Java APIs, with no bridging or configuration, just as if they were written in Swift. The Skip [documentation](/docs/platformcustomization/#calling-kotlin-api) provides details.
330
+
Skip's ability to transpile Swift to Kotlin is one of its strengths. Transpiled Swift code effectively *is* Kotlin (we call this hybrid dialect [Kotlish](/docs/swiftsupport/#kotlish)), which gives it a superpower: it can directly call any other Kotlin/Java APIs, with no bridging or configuration, just as if they were written in Swift. The Skip [documentation](/docs/platformcustomization/#calling-kotlin-api) provides details.
331
331
332
332
When you enable bridging on a transpiled module and expose its API to native Swift, you are also exposing this superpower. How? Let's consider an example. Suppose that your native Swift wants to store sensitive data in Android's encrypted shared preferences, which are only accessible via Kotlin. We choose to make a reusable library to expose this functionality to Swift.
Copy file name to clipboardExpand all lines: src/content/docs/docs/platformcustomization.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,8 @@ If you are using [Skip Lite](/docs/modes/#lite), *all* of your Swift is transpil
91
91
92
92
When you call Kotlin and Java code from within transpiled `#if SKIP` blocks, remember that you are still writing *in Swift*. The code is still parsed by Xcode, so it must have valid Swift syntax. But it is excluded from your iOS build and invisible to the Swift compiler, which allows it to make any syntactically valid API call without causing Xcode errors. Just write natural Swift code, and imagine that the Kotlin or Java API you're calling is a Swift library API. Skip's transpiler will take care of the rest.
93
93
94
+
We sometimes call this hybrid dialect [Kotlish](/docs/swiftsupport/#kotlish): code that is syntactically Swift but transpiles to Kotlin. The [Kotlish documentation](/docs/swiftsupport/#kotlish) covers the dialect in depth, including its limitations and the escape hatches available when the transpiler needs a hand.
95
+
94
96
If you're attempting to cut and paste Kotlin inline, you'll have to turn it into valid Swift to avoid syntax errors. Luckily, the languages are extremely similar. You'll typically only have to change a few calling conventions:
95
97
96
98
- Named parameter values in Kotlin are specified with an equals (`=`) sign, whereas in Swift they use a colon (`:`). Note that parameter names are never required in Kotlin.
0 commit comments