Scroll View Items Come Over the Navigation Bar in SwiftUI

4.4k Views Asked by At

I made a custom nav bar. and added a scroll view below it. The problem I am getting is when I scroll down, the data inside scroll view comes over the navigation bar. Here is the screenshot:

scroll view image

My code is:

struct NewsfeedView: View {
    
    var newsfeedModel: [NewsFeedData]
    
    var body: some View {
        
        VStack {
            
            CustomNavBar(navTitle: "Newsfeed")
            
            ScrollView {
                LazyVStack{
                    ForEach(newsfeedModel) { modelData in
                         
                        NewsFeedTableViewCell(newsFedd: modelData)
          }
        }
      }
    }.ignoresSafeArea()
  }
}

Does anyone knows what is the issue?

1

There are 1 best solutions below

3
On BEST ANSWER

If it's undesired then just clip it, like

ScrollView {
  // .. content here
}
.clipped()    // << here !!