SwiftUIListSeparator
SwiftUIListSeparator copied to clipboard
List no longer visible after applying .listSeparatorStyle(.none) in iOS 14
The title basically says it all. Is this tested to work for lists with sections?
I have not tested it for this scenario yet. I will try to reproduce and see if I can find a fix. Thanks for opening the issue!
Nice! I made a small example that demonstrates it: https://github.com/alexander-larsson/ExampleList
@alexander-larsson Thanks for the sample project it was incredibly helpful! I have an experimental branch up and running that I believe fixes this issue. The only downside is a bit of a CPU spike when scrolling because it now listens for scrollview content offset to change and anytime it does it attempts to hide dividers again. I am going to continue working on improving the performance but if you can test it out to confirm it works I think it should be good enough to merge to master and I will open a new enhancement ticket for the minor performance issues.
Checkout this branch: https://github.com/SchmidtyApps/SwiftUIListSeparator/tree/xcode12-issues

It works for me in my first basic example but I'm actually using it in a use case with rounded cards in the list. The lines are still there in that use case. When I was updating my sample project to reproduce the issue I discovered that setting the background color of the list made the lines re-appear. I have pushed a new commit that domonstrates the problem to: https://github.com/alexander-larsson/ExampleList
Haha I'll take another look with the new example. It's infuriating that this isn't just built in SwiftUI functionality!
Yes! It feels like you are supposed to use LazyVStack on iOS 14 for this use case. Might implement a solution based on using List on iOS 13 and LazyVStack on iOS 14 if this doesn't end up working out.
Hello. I have the same issue and I want to add that list is visible, but not every time I run my app. After several restarts it works, just FYI.
So while my library seems to work fairly well for many implementations it is clear that depending on specific setups sometimes the underlying UIKit code backing the SwiftUI list changes and ends up breaking my workaround. If it is not working my current suggestion would be to do something along the lines of:
if #available(iOS 14, *) {
LazyVStack { content() }
} else {
List { content() }
}
func content() -> some View {
//Table rows go here
}
@SchmidtyApps LazyVStack does not reuse cells and will make List with content heavier than Text("Hello") lag as hell while scrolling. I guarantee that