-
|
I’d like to migrate my existing iOS app to a Skip app. Based on previous advice, I’ve decided not to convert the current app directly and instead create a new Skip project. My question is: Is it possible to create a shared Swift package that both the existing iOS app and the new Skip app can use—specifically to share SwiftUI views or other UI code? The current app is already in the App Store, so I need to continue improving it while also building the new Skip version. I’m hoping for a setup that lets both apps share as much view code as possible. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
You can create shared libraries. But... the whole point is one App that compiles for both platforms with differences in #if when necessary. For your project, before you try and migrate, have very thorough read up of the differences between Swift and SwiftUI and what is actually implemented cross platform. I have just done exactly this for a rather small project and I did get to a common code base - the Kotlin route. But it is a simple app. I have also found ChatGPT to be very helpful. |
Beta Was this translation helpful? Give feedback.
-
|
You can certainly create a shared package that you can use from multiple app targets. In fact, this is the way we encourage Skip to be used: many separate modules that are each individually testable. How you proceed with this will depend on your app's architecture and whether you plan to use native Skip Fuse or transpiled Skip Lite. One good starting point might be the Skip Motion example (https://skip.tools/docs/modules/skip-motion/), which is a shared SwiftPM module that exports a SwiftUI view that allows you to play Lottie animations. It supports bridging, so it can be used in either a Skip Lite app (like https://github.com/skiptools/skipapp-showcase/blob/main/Sources/Showcase/LottiePlayground.swift) or in a full Skip Fuse app (like https://github.com/skiptools/skipapp-showcase-fuse/blob/main/Sources/ShowcaseFuse/LottiePlayground.swift). You can read about getting started with a Skip framework at https://skip.tools/docs/gettingstarted/#framework_development. Do let us know if you have any questions or would like any further advice, either here on the Skip Slack channel. |
Beta Was this translation helpful? Give feedback.
You can certainly create a shared package that you can use from multiple app targets. In fact, this is the way we encourage Skip to be used: many separate modules that are each individually testable.
How you proceed with this will depend on your app's architecture and whether you plan to use native Skip Fuse or transpiled Skip Lite. One good starting point might be the Skip Motion example (https://skip.tools/docs/modules/skip-motion/), which is a shared SwiftPM module that exports a SwiftUI view that allows you to play Lottie animations. It supports bridging, so it can be used in either a Skip Lite app (like https://github.com/skiptools/skipapp-showcase/blob/main/Sources/Showcase/LottiePl…