Skip to content

Instantly share code, notes, and snippets.

@cecipirotto
Created August 10, 2021 15:12
Show Gist options
  • Save cecipirotto/3bec89e9439b5c6497bfc3645867e738 to your computer and use it in GitHub Desktop.
Save cecipirotto/3bec89e9439b5c6497bfc3645867e738 to your computer and use it in GitHub Desktop.
struct MyPagerView: View {
...
..
.
var body: some View {
PagerTabStripView() {
MyHomeView(model: $homeModel).pagerTabItem {
MyNavBarItem(title: "Home", imageName: "home")
}.onPageAppear {
homeModel.reloadData()
}
MyTrendingView(model: $trendingModel).pagerTabItem {
MyNavBarItem(title: "Trending", imageName: "trending")
}
.onPageAppear {
trendingModel.reloadData()
}
if user.isLoggedIn {
MyProfileView().pagerTabItem {
MyNavBarItem(title: "Account", imageName: "account")
}
}
}
.pagerTabStripViewStyle(PagerTabViewStyle(tabItemSpacing: 0,
tabItemHeight: 70,
indicatorBarHeight: 7,
indicatorBarColor: selectedColor))
}
}
PagerTabStripView() {
MyFirstView()
.pagerTabItem {
TitleNavBarItem(title: "Tab 1")
}
MySecondView()
.pagerTabItem {
TitleNavBarItem(title: "Tab 2")
}
if User.isLoggedIn {
MyProfileView()
.pagerTabItem {
TitleNavBarItem(title: "Profile")
}
}
}
PagerTabStripView(selection: $selection) {
ForEach(1...10, id: \.self){
MyPagerChildView()
.pagerTabItem {
TabInfoView(title: "Page Info Title \($0)")
}
}
}
PagerTabStripView(selection: $selection) {
ForEach(1...10, id: \.self){
MyPagerChildView()
.pagerTabItem {
VStack {
Text("Page \($0)")
.foregroundColor(theme.textColor)
.font(.subheadline)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.white)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment