-
I'm looking to add https://github.com/ukushu/Ifrit to my transpiled Skip app. It has zero dependencies of its own, and it's green on https://swift-everywhere.org/. Initially, I tried just adding it as a package dependency. That sort of worked, but I could only use Ifrit in I've read https://skip.tools/docs/porting/ but I'm still pretty stumped. At the current latest commit ukushu/Ifrit@e6d21b0 I can run The porting guide says, "Once all your tests pass, you’ve successfully brought your Swift package to Android!" … but how do I actually use this "ported" library in my transpiled Skip app? https://skip.tools/docs/dependencies/ says that when my transpiled app adds a dependency on "Pure Swift Package Manager Dependencies,"
So, now what? I guess I could fork the dependency and add a I also tried To my surprise, I found that Ifrit failed to compile, with this error:
Sure enough, I don't understand how Ifrit could possibly be green on https://swift-everywhere.org/ with this build error. Similarly, I don't understand how What's the difference between what |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This comes down to the distinction between the native and transpiled modes. By default Skip runs in pure transpiled mode, but packages need to all be "Skip-aware", in that they use the The native mode is newer, and enables you to use pure non-transpiled Swift that is compiled directly for Android. This gives you the power to access any Swift package, provided it can build for Android (e.g., it passes on https://swift-everywhere.org/). In this particular case, you could run something like this:
This would create a // swift-tools-version: 5.9
// This is a Skip (https://skip.tools) package,
// containing a Swift Package Manager project
// that will use the Skip build plugin to transpile the
// Swift Package, Sources, and Tests into an
// Android Gradle Project with Kotlin sources and JUnit tests.
import PackageDescription
let package = Package(
name: "demo-app-native",
defaultLocalization: "en",
platforms: [.iOS(.v17), .macOS(.v14), .tvOS(.v17), .watchOS(.v10), .macCatalyst(.v17)],
products: [
.library(name: "DemoAppApp", type: .dynamic, targets: ["DemoApp"]),
.library(name: "DemoModule", type: .dynamic, targets: ["DemoModule"]),
],
dependencies: [
.package(url: "https://source.skip.tools/skip.git", from: "1.3.8"),
.package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"),
.package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0"),
.package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0"),
.package(url: "https://github.com/ukushu/Ifrit.git", from: "2.0.0")
],
targets: [
.target(name: "DemoApp", dependencies: [
"DemoModule",
.product(name: "SkipUI", package: "skip-ui")
], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),
.testTarget(name: "DemoAppTests", dependencies: [
"DemoApp",
.product(name: "SkipTest", package: "skip")
], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),
.target(name: "DemoModule", dependencies: [
.product(name: "SkipFoundation", package: "skip-foundation"),
.product(name: "SkipFuse", package: "skip-fuse"),
.product(name: "Ifrit", package: "Ifrit")
], plugins: [.plugin(name: "skipstone", package: "skip")]),
.testTarget(name: "DemoModuleTests", dependencies: [
"DemoModule",
.product(name: "SkipTest", package: "skip")
], plugins: [.plugin(name: "skipstone", package: "skip")]),
]
) The Hopefully that makes sense. The native mode is relatively new for Skip, and so it isn't completely represented in the documentation. But it is a focus of much of our current efforts, so if you encounter issues with it, please do raise them with us. |
Beta Was this translation helpful? Give feedback.
This comes down to the distinction between the native and transpiled modes. By default Skip runs in pure transpiled mode, but packages need to all be "Skip-aware", in that they use the
skipstone
plugin themselves (whichIfrit
does not).The native mode is newer, and enables you to use pure non-transpiled Swift that is compiled directly for Android. This gives you the power to access any Swift package, provided it can build for Android (e.g., it passes on https://swift-everywhere.org/).
In this particular case, you could run something like this: