title: Extra space in the Top of Detail View that won't go away (SwiftUI)
body: <p>I have an extra space in a detail view that won't go away. The view comes from a NavigationLink but I've tried it with or without a NavigationView. I tried to wrap it replace the ScrollView with the NavigationView but that didn't work. I think a lot of Swift coders have encountered this problem and there's no proper answer out there that worked for me.</p>
  <p>This is my DetailView</p>
  <pre><code>struct DetailView: View {
      var body: some View {
                  
          ScrollView {
              VStack(alignment: .leading) {
                  Text(&quot;Huge Font Recipe Title&quot;)
                  .font(.system(size: 48, weight: .bold))
                  .foregroundColor(.black)
                  .padding([.leading, .top, .trailing])
                                              
                      VStack {
                          Image(&quot;img1&quot;)
                              .resizable()
                              .frame(width: 375, height: 375)
                              .aspectRatio(contentMode: .fit)
                              .frame(width: UIScreen.main.bounds.width)
                              
                          Spacer()
  
                              
                          }.padding(.bottom)
                                                          
  
                      }
                    }
                 }
              
  }
               
  struct DetailView_Previews: PreviewProvider {
      static var previews: some View {
          DetailView()
      }
  }
  </code></pre>
  <p>And this is the Parent view (Content View) which holds the NavigationView</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
      var body: some View {
  
          NavigationView {
  
              ScrollView (showsIndicators: false) {
                      VStack(spacing: 20) {
                          ForEach(recipecardData) { item in
  
                              NavigationLink(
                              destination: DetailView()) {
  
                              RecipeCards( card: item)
                          }
                      }
                  }
  
                          }
          .navigationBarTitle(&quot;Navigation&quot;)
                      }
              }
  }
  
  
  
              struct RecipeCards: View {
  
                  var card: RecipeCard
  
                  var body: some View {
  
                      ZStack {
                          Image(card.imageName)
                              .resizable()
                              .aspectRatio(contentMode: .fit)
                              .frame(width: 334, height: 335)
                              .cornerRadius(10)
                              .padding()
                              .shadow(radius: 16)
  
                          Rectangle()
                              .foregroundColor(.clear)
                              .background(LinearGradient(gradient: Gradient(colors: [.red, .blue]), startPoint: .bottom, endPoint: .top)
              )
                              .frame(width: 334, height: 335)
                             .cornerRadius(10)
  
  
                          HStack {
  
                              Text(card.title)
                                  .font(.system(size: 27,weight: .bold))
                                  .foregroundColor(.white)
                                  .frame(minWidth: 10, maxWidth: .infinity, alignment: .leading)
                                  .lineLimit(2)
                                  .padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 20))
  
                              }
  
                          .padding(.bottom, 268)
                          .padding(EdgeInsets(top: 0, leading: 34, bottom: 0, trailing: 8))
                      }
                  }
              }
  
  
              struct RecipeCard: Identifiable {
                  var id = UUID()
                  var title: String
                  var imageName: String
  
              }
  
              let recipecardData =  [
              RecipeCard(title: &quot;Title 1&quot;, imageName: &quot;img1&quot;),
              RecipeCard(title: &quot;Title 2&quot;, imageName: &quot;img2&quot;)
              ]
  
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  </code></pre>