|
Hi, I'm quite new to development with Swift and SwiftUI so apologies if this is a bad question. I have been playing around with Skip recently, and I wanted to have two views: On the entry point of the program and in the public struct Poking around files and a few google searches makes me feel that this is a Kotlin error and not a Swift problem. My files: import SwiftUI
public struct ContentView: View {
public var body: some View {
VStack(spacing: 16.0) {
NavigationStack{
NavigationLink(destination: ContentView2()){
Label("Click Me", systemImage: "hand.wave")}
}
}
.padding()
}
}
#Preview {
ContentView()
}ContentView2.swift (Preview works) import SwiftUI
public struct ContentView2: View {
public var body: some View {
Text("Hello, World!")
}
}
#Preview {
ContentView2()
}HelloSkipApp (entry point file) import Foundation
import OSLog
import SwiftUI
let logger: Logger = Logger(subsystem: "com.idk.HelloSkip", category: "HelloSkip")
/// The Android SDK number we are running against, or `nil` if not running on Android
let androidSDK = ProcessInfo.processInfo.environment["android.os.Build.VERSION.SDK_INT"].flatMap({ Int($0) })
/// The shared top-level view for the app, loaded from the platform-specific App delegates below.
///
/// The default implementation merely loads the `ContentView` for the app and logs a message.
public struct RootView : View {
public init() {
}
public var body: some View {
ContentView()
.task {
logger.log("Welcome to Skip on \(androidSDK != nil ? "Android" : "Darwin")!")
logger.warning("Skip app logs are viewable in the Xcode console for iOS; Android logs can be viewed in Studio or using adb logcat")
}
}
}
#if !SKIP
public protocol HelloSkipApp : App {
}
/// The entry point to the HelloSkip app.
/// The concrete implementation is in the HelloSkipApp module.
public extension HelloSkipApp {
var body: some Scene {
WindowGroup {
RootView()
}
}
}Does this involve Creating a Multi-Module App in the Skip Documentation or adding Targets in Xcode? How can I get my build to succeed? Thanks in advance and have a great day ahead! NOTE: I'm not sure if this is related, but after installing Skip when creating a new swift file in Xcode, I no longer have an option to rename the swift file before it is created. Could this be causing issue? |
Replies: 1 comment 2 replies
|
Rather than doing this:
I think you need to do this (note the extra braces):
This is due to difficulty Skip has with supporting the autoclosure-style argument for the
I'm not sure what you mean by this. Do you mean Xcode's "Choose a template for your new file:" dialog that results from |
Rather than doing this:
I think you need to do this (note the extra braces):
This is due to difficulty Skip has with supporting the autoclosure-style argument for the
NavigationLink. Please try that out and let us know if it helps.