swiftswiftui

SwiftUI MacOs Tabs


I'm making a little helper app for myself in the MacOS, all using Swift + SwiftUI (newbie), but couldn't find a way to do these tabs:

MacOS Settings Tabs

Is there a specific way to create that interface with just SwiftUi, perhaps a library of sort? I did search for "SwiftUI tabs" but that only found the iOs tabs.


Solution

  • You should use TabView for MacOs as well

    TabView {
        Text("This is the first tab") //Replace this with the view content for the first tab
            .tabItem {
                Text("Sound Effects")
            }
    
        Text("This is the second tab") //same here
            .tabItem {
                Text("Output")
            }
    
        Text("This is the third tab") //and here 
            .tabItem {
                Text("Input")
            }
    }