import SwiftUI
struct OnboardingView: View {
@ObservedObject var viewModel: OnboardingViewModel
var physique: some View {
TabView(choice: $viewModel.currentPage) {
ForEach(OnboardingPages.allCases, id: .rawValue) { web page in
getPageView(for: web page)
.tag(web page.rawValue)
}
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .by no means))
}
@ViewBuilder
personal func getPageView(for web page: OnboardingPages) -> some View {
VStack(spacing: 32) {
Spacer()
VStack(alignment: .middle, spacing: 8) {
Textual content(web page.title)
.font(.urb(.semiBold, measurement: 32))
.foregroundStyle(.white)
Textual content(web page.description)
.font(.urb(.common, measurement: 16))
.foregroundStyle(.white)
.multilineTextAlignment(.middle)
}
continueButton
dots
}
.padding(.horizontal, 16)
.padding(.backside, 35)
.ignoresSafeArea()
.background(
Picture(web page.picture)
.resizable()
.scaledToFill()
.ignoresSafeArea()
)
}
The issue is:
- Even with out NavigationStack, ignoresSafeArea stretches TabView out of secure space
- If ignoresSafeArea modifier is used with TabView, then content material is transcend secure space
- If ignoresSafeAre modifier isn’t used with TabView, then the picture doesn’t cowl full display screen
| VStack and no secure space: | Vstack and secure space: |
|---|---|
![]() |
![]() |


