article

Friday, September 24, 2021

SwiftUI Simple TabView(PageTabView)

SwiftUI Simple TabView(PageTabView)
ContentView.swift
 
//
//  ContentView.swift
//  Swiftuitest
//
//  Created by Cairocoders
//

import SwiftUI

struct ContentView: View {
    
    private var imageNames:[String] = ["1", "2","3","4","5","6","7"]
    var body: some View {
        
        TabView {
            TabView {
                ForEach(imageNames, id:\.self) {
                    imageNames in
                    
                    Image(imageNames)
                }
            }.tabViewStyle(PageTabViewStyle())
        }.frame(width: UIScreen.main.bounds.width - 20, height: 300, alignment: .center).cornerRadius(10)
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Related Post