This code gives an error when compiled, and it looks really simple. It should be a test screen for tabview in app. Maybe somebody knows what s wrong?
import SwiftUI
struct screenone: View {
var body: some View{
ZStack {
Text ("Screen 1")
. bold()
.foregroundColor(.white)
}
frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.mint)
.clipped()
}
}
struct screenone_previews: PreviewProvider{
static var previews: some View{
screenone()
}
}
2
Answers
Did you change
ContentView()
toScreenone()
in yourApp
struct? If not try replacing yourApp
struct with the code below.Once that is done replace your
screenone
struct with the following:The code above works for me.
In the future please provide the specific error so that it is easier to address your problem!
After your ZStack{} ended, you forgot to put a dot . before frame. Put the dot and run again. Follow the below code.
If this does not work, then you should include your error message here because let us assume your error is not the way to help you.
Still, that . is surely the error.