Tabview doesn't show the content of second tab

Hi everybody ✌-1F3FB;,


hopefully there's someone out there who can help me.

At first, i'm new to SwiftUI and sorry for my english, i can understand and read it very good but i'm not the best at writing or speaking.

Whatever, i need some information for these codes below.


What do i have to use in TabView(selection: ???) ?

In the selection part there's actually the grey Box with Selection in it, because if i don't use anything inside like this: Tabview( ) or Tabview{...} XCode throws some fails and errors.

struct AppView: View {
    var body: some View {
        HStack(content: {
        TabView(selection: /*@START_MENU_TOKEN@*/ /*@PLACEHOLDER=Selection@*/.constant(1)/*@END_MENU_TOKEN@*/) {
            PlanView().tabItem{
                    Text("plans")
                Image(systemName: "calendar")
                }
            InfoView().tabItem {
                    Text("Info")
                    Image(systemName: "info.circle.fill")
                }
            }
        })
    }
}



That is the code, which i'm using for my Content in the TabView. In preview sometimes it is showing the way how i coded it, but when i'm trying to use the App for example on my phone it won't work anymore.

Does someone know who to fix this problem?

struct InfoView: View {
    var body: some View {
//        Text("hi")
        
        Form(){
            Section{
                Text("Info")
                    .font(.largeTitle)
                    .fontWeight(.bold)
                    .multilineTextAlignment(.center)
            }
            Section{
                Text("blabla")
                Text("whatever")
                Text("hi")
            }
        }
    }
}


Thank you in advance! 😊

Replies

If you want someone to test, please post the complete code, with


PlanView, TabView (how is selection defined), ContentView, PlanView, etc… The whole code please.