I am working on a TabView
but I want to show an image that occupies the entire screen and the rest of the content in a normal way.
In vertical mode it works correctly but in horizontal mode part of the content bites the notch.
How can I correct this?
My code is as follows:
ContentView.swift
struct ContentView: View {
@State private var selection = 0
var body: some View {
TabView(selection: $selection){
Home()
.tabItem {
VStack {
Image("first")
Text("First")
}
}
.tag(0)
Text("Second View")
.font(.title)
.tabItem {
VStack {
Image("second")
Text("Second")
}
}
.tag(1)
} .edgesIgnoringSafeArea(.top)
}
}
Home.swift
struct Home: View {
var body: some View {
GeometryReader { geometry in
ZStack {
Color(.red)
.edgesIgnoringSafeArea(.all)
ScrollView {
VStack {
Image("slider_concierto1")
.resizable()
//.edgesIgnoringSafeArea(.all)
.frame(height: 250)
.aspectRatio(contentMode: .fit)
VStack {
Text("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.")
}
.padding()
//.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.topLeading)
.background(RoundedRectangle(cornerRadius: 16) .foregroundColor(Color.green))
.padding()
}
.frame(width: geometry.size.width)
} //scrollview
} //GEO
}//geo
.edgesIgnoringSafeArea(.all)
}
}