Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created June 28, 2020 08:29
Show Gist options
  • Save prafullakumar/77623ad916e65863467e152a6acd3a0f to your computer and use it in GitHub Desktop.
Save prafullakumar/77623ad916e65863467e152a6acd3a0f to your computer and use it in GitHub Desktop.
// Created by Prafulla Singh on 23/6/20.
//
import SwiftUI
struct ContentView: View {
var body: some View {
ScrollView {
LazyHStack {
PageView()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct PageView: View {
var body: some View {
TabView {
ForEach(0..<30) { i in
ZStack {
Color.black
Text("Row: \(i)").foregroundColor(.white)
}.clipShape(RoundedRectangle(cornerRadius: 10.0, style: .continuous))
}
.padding(.all, 10)
}
.frame(width: UIScreen.main.bounds.width, height: 200)
.tabViewStyle(PageTabViewStyle())
}
}
@xuanzi23
Copy link

I need the tabview load the view lazily, is it possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment