2020-03-02a minute read (About 122 words)How to make tab view in SwiftUIIssue #614 12345678910111213141516171819202122232425262728293031323334353637383940414243444546struct MyTabView: View { @EnvironmentObject var preferenceManager: PreferenceManager var body: some View { VOrH(isVertical: preferenceManager.preference.position.isVertical) { OneTabView(image: "one", text: "One", tab: .one) OneTabView(image: "two", text: "Two", tab: .two) OneTabView(image: "three", text: "Three", tab: .three) Spacer() } }}struct OneTabView: View { @EnvironmentObject var preferenceManager: PreferenceManager let image: String let text: String let tab: Tab var selected: Bool { preferenceManager.preference.tab == tab } var body: some View { Button(action: { self.preferenceManager.preference.tab = self.tab }) { VStack(spacing: 2) { Image(image) .renderingMode(selected ? .original : .template) .resizable() .aspectRatio(contentMode: .fit) .frame(height: 20) Text(text) .font(.system(.caption, design: .rounded)) .fontWeight(selected ? .semibold : .none) } } .padding(.horizontal, 4) .buttonStyle(BorderlessButtonStyle()) .frame(width: 60, height: 50) .background(selected ? R.color.selectedTabBackground : Color.clear) .cornerRadius(4) }}#swiftswiftUI