Created
August 10, 2021 15:12
-
-
Save cecipirotto/3bec89e9439b5c6497bfc3645867e738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PagerTabStripView() { | |
MyFirstView() | |
.pagerTabItem { | |
TitleNavBarItem(title: "Tab 1") | |
} | |
MySecondView() | |
.pagerTabItem { | |
TitleNavBarItem(title: "Tab 2") | |
} | |
if User.isLoggedIn { | |
MyProfileView() | |
.pagerTabItem { | |
TitleNavBarItem(title: "Profile") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PagerTabStripView(selection: $selection) { | |
ForEach(1...10, id: \.self){ | |
MyPagerChildView() | |
.pagerTabItem { | |
TabInfoView(title: "Page Info Title \($0)") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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