Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created February 7, 2021 07:28
Show Gist options
  • Save prafullakumar/720c56e3ac22631a16c1b8a4d96461c6 to your computer and use it in GitHub Desktop.
Save prafullakumar/720c56e3ac22631a16c1b8a4d96461c6 to your computer and use it in GitHub Desktop.
struct PageView: View {
@Binding var selection: Int
let dataModel: [String]
var body: some View {
TabView(selection:$selection) {
ForEach(0..<dataModel.count) { i in
VStack {
HStack {
Text(dataModel[i])
.foregroundColor(Color.primary)
.padding()
Spacer()
}
Spacer()
}.tag(i)
}
}
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - 170)
//give padding nav height + scrollable Tab
.tabViewStyle(PageTabViewStyle.init(indexDisplayMode: .never))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment