I would like it so that .edgesIgnoringSafeArea(.all) fits the content right onto the top of the canvas
I would like it to show like this: https://i.stack.imgur.com/RzrO6.png
Instead, it shows like this: https://i.stack.imgur.com/sbbaU.png
Content view:
TabView {
NavigationView {
MainContentView()
}
...
}
Main content view:
var body: some View {
VStack(alignment: .leading, spacing: 20) {
...
}
.padding([.horizontal, .top])
.navigationBarTitle("Title")
}
Detailed view:
struct PostDetail: View {
var post: Post
var body: some View {
List {
Image(post.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.listRowInsets(EdgeInsets())
VStack(spacing: 20) {
Text(post.name)
.foregroundColor(.primary)
.font(.largeTitle)
.fontWeight(.bold)
Text(post.description)
.foregroundColor(.primary)
.font(.body)
.lineLimit(nil)
.lineSpacing(12)
VStack {
HStack {
Spacer()
ViewMoreButton(post: post)
Spacer()
}
}
}
.padding(.top)
.padding(.bottom)
}
.edgesIgnoringSafeArea(.top) //Does nothing!
.navigationBarHidden(true) // Does nothing!
}
}