ContentView.swift
// // ContentView.swift // swiftuidev // // Created by Cairocoders // import SwiftUI struct ContentView: View { @State var currentTab = 0 var body: some View { VStack{ Picker(selection: $currentTab, label: Text("")) { Image(systemName: "house.fill").tag(0) Image(systemName: "person.crop.circle").tag(1) Image(systemName: "paperplane.fill").tag(2) }.pickerStyle(SegmentedPickerStyle()) .padding(.top, 10) Spacer() if currentTab == 0 { page1() } if currentTab == 1 { page2() } if currentTab == 2 { page3() } } } } struct page1: View { var body: some View { VStack { Text("page 1") Image("photo1") } } } struct page2: View { var body: some View { VStack { Text("page 2") Image("photo2") } } } struct page3: View { var body: some View { VStack { Text("page 3") Image("photo3") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }