i use Apple ipad pro M1 for codding a Swift and SwiftUI, but now i stop here because i do not now what i should do to this error
the code:
import SwiftUI
import PlaygroundSupport
struct Welcomming:App {
var body: some Scene {
WindowGroup {
TabView {
Text("one")
Text("tow")
}
}
}
}
And the error:
No exact matches call 'setLiveView' nstanc method
This image for the code and error
CodePudding user response:
setLiveView
takes a SwiftUI View
as a parameter. You are trying to send it Welcomming
which is defined as an App
. Instead, encapsulate your view into a View
you can send to the PlaygroundPage
:
struct ContentView : View {
var body: some View {
TabView {
Text("one")
.tabItem {
Text("One")
}
Text("two")
.tabItem {
Text("Two")
}
}
}
}
PlaygroundPage.current.setLiveView(ContentView())