In SwiftUI, list view by default takes up entire height of the screen and pushes other elements/views to the bottom of the screen. But I want to append some elements/views where the list items exactly end.
Asked
Active
Viewed 2,111 times
1
-
For those looking for an answer, I have answered similar questions [here](https://stackoverflow.com/a/68837419/9607863) and [here](https://stackoverflow.com/a/68928117/9607863) which may help. – George Aug 25 '21 at 18:32
1 Answers
2
You can add spacer() at appropriate places in the VStack or try something like below:
VStack {
CustomView1()
List {
Section(header: HeaderView(), footer: FooterView())
{
ForEach(viewModel.permissions) { permission in
CustomeView2()
}
GeneralView()//add the views at the end of list items
}
}.listStyle(GroupedListStyle())
}

Subha_26
- 440
- 4
- 14
-
Thank you, including all the buttons and list in one section worked. Spacer does not work in this case, I have tried before. – Jagan Mohan Sahu Jul 11 '20 at 14:49