Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Scroll View Items Come Over the Navigation Bar in SwiftUI

I am new to SwiftUI. 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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

If it’s undesired then just clip it, like

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading