Add a bottom divider to your SwiftUI view!
Where we learn to look around thoroughly before blindly trusting strangers.
So... I had a search bar, just beneath the navigation bar, and beneath it, a list. To avoid having the list's items disapear seemingly in the middle of nowhere, I wanted to add a divider between my search bar and my list.
Pretty standard, right? In Swift, I simply used to creat a full-width, 1 one pixel high view of my chosen color, and position it between whatever views or elements I wanted to separate.
But how does one get it done in SwiftUI?
After fumbling a bit, I looked around. And I found this:
It works. But my divider now had some padding beneath it. So my list's content still disapeared into and appeared from nothing when scrolling, which just wasn't good enough.
So I kept looking around. And that's when I stumbled onto it:
Yes. You read right. We now have an actual thing that explicitely exists for the sole purpose of separating visual elements.
Put it in a VStack, and there you go!