-
|
Hello, I have been following Skip for a long while and couple of days ago I started experimenting with it. I already have all the examples working and set it up my personal project My SwiftUI application is quite large, with numerous extensions, modules, and custom components. I’m hoping to avoid major restructuring, as that would involve significant changes. For example, consider this code snippet: I have used skip init --zero --appid=co.myapp project-name "MyApp"
extension Font {
enum Georgia: FontStyle {
case regular
static let Regular = Font.custom(Font.Georgia.regular.name, size: 10, relativeTo: .title)
var name: String {
switch self {
case .regular: return "Georgia"
}
}
static func regular(size: CGFloat, relativeTo textStyle: Font.TextStyle? = nil) -> Font {
Georgia.regular.font(size: size, relativeTo: textStyle)
}
}
}
This throws the following error:
`This extension cannot be merged into its extended Kotlin type, because its type is defined outside of this module. Therefore the extension can only include properties and functions`
Additionally, this simple extension:
`extension CGSize {
static func + (lhs: CGSize, rhs: CGSize) -> CGSize {
CGSize(
width: lhs.width + rhs.width,
height: lhs.height + rhs.height
)
}
}`
Fails with the error:
Skip does not support custom operators. Consider using a standard function.
These are just a couple of examples, but I expect more such limitations as I continue integrating Skip into this large codebase.
Also if I use the following to setup the project
skip init --native-app --appid=co.myapp project-name "MyApp"
struct ScrollViewIfNeeded<Content: View>: View {
@State var offset: CGSize?
@ViewBuilder let content: () -> Content
@State private var contentSize: CGSize = .zero
@State private var scrollViewSize: CGSize = .zero
var body: some View {
ScrollView(shouldScroll() ? [.vertical] : []) {
content()
.readSize($contentSize)
}
.readSize($scrollViewSize)
}
// Must be internal (not private) for Skip compatibility
func shouldScroll() -> Bool {
if let offset = offset {
return scrollViewSize.height <= contentSize.height + offset.height
} else {
return scrollViewSize.height <= contentSize.height
}
}
}
Fails with the error and I get many of them:
Private state property 'bottomPadding' cannot be bridged to Android. Consider making this property internal
I’d appreciate any guidance or roadmap insights on supporting extensions for system types, using enums and computed properties in extensions, handling or replacing custom operators, and avoiding major refactors when porting large SwiftUI apps to Skip.
Thanks for the amazing work on Skip. I’m excited about the potential and want to contribute feedback as I integrate it into a real-world project. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Many of these errors are indeed limitations in Skip Lite's transpiled mode, many of which are listed at https://skip.tools/docs/swiftsupport/. You may want to consider trying with a natively-compiled Skip Fuse app, which supports 100% of the Swift language. For more details on the distinction, take a look at https://skip.tools/docs/modes/ |
Beta Was this translation helpful? Give feedback.
Many of these errors are indeed limitations in Skip Lite's transpiled mode, many of which are listed at https://skip.tools/docs/swiftsupport/.
You may want to consider trying with a natively-compiled Skip Fuse app, which supports 100% of the Swift language. For more details on the distinction, take a look at https://skip.tools/docs/modes/