-
Hello, I am attempting to create a dual-platform wrapper library around a third-party SDK (Mapbox Maps) that supplies iOS and Android variants, but is not supported on macOS. Is there a way to do this? I'm still learning the in's and out's of SKIP, so apologies if this is a noob question. But from what I understand Skip needs the macOS platform to transpile to Kotlin, so I can't just remove that platform. If I simply add the Mapbox dependency to Package.swift ( ![]() I'm assuming this is due to Mapbox not supporting macOS. And if I edit the dependency in Package.swift to: I'm not sure how to proceed at the moment or if this is just a limitation of Skip. I'm hoping somebody may have come across this before and figured out a workaround. It would be great to have a dual-platform Skip library for maps. Mapbox is an obvious choice for this. Any advice is appreciated. John |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
I think this is the way to go. Can you just guard the import in a check that the platform is not macOS? e.g.:
You could simply put And this sounds like it will be a very useful framework! Please do let us know if we can help in any way with its development, as it will be a great addition to the Skip ecosystem. |
Beta Was this translation helpful? Give feedback.
-
![]() |
Beta Was this translation helpful? Give feedback.
The transpiler's analysis of compiler directives is unfortunately pretty dumb. Basically it treats SKIP as true, and pretty much everything else as false. So I use a pattern like:
#if os(macOS) // Skip sees this as false
#else // so Skip sees this as true
...
#endif
Or combinations like:
#if SKIP || !os(macOS)
...
#endif