79141931

Date: 2024-10-30 16:21:02
Score: 1
Natty:
Report link
public struct TeamBContentView : View {
@State private var selectedTab = 0
public init() {}

public var body: some View {
    VStack {
        // Use picker view and set picker style as segmented
        Picker("Tabs", selection: $selectedTab) {
            Text("Home").tag(0)
            Text("About Us").tag(1)
            Text("Contact Us").tag(2)
        }
        .pickerStyle(.segmented)
        .padding()
        
        Spacer()
        
        // Then display the view based on the tab selected
        switch selectedTab {
        case 0:
            Text("This is home screen")
        case 1:
            Text("This is about us screen")
        case 2:
            Text("This is contact[enter image description here][1] us screen")
        default:
            Text("This is home screen")
        }
        Spacer()
    }
    .navigationBarBackButtonHidden() // use this to hide the back button
}
}
Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: David Ugochukwu Okonkwo