I am using a List to dynamically create multiple instances of a view, however, when using list padding is added to the left and right of the child views and I can't remove it. I've tried using .listRowInset, but that has yielded no visible effect.
I have created a PostView that works as desired. I am using a 'PostsView' to dynamically generate multiple PostView instances.
The am trying to get the image in the PostView to touch the edges of the screen within the PostsView.
PostView
import SwiftUI
struct PostView: View {
var post: Post
var body: some View {
VStack {
HStack {
Text(post.songInfo.album).font(.title)
Spacer()
Text(post.songInfo.artist)
}.padding()
Image(post.songInfo.albumArtUrl)
.resizable()
.aspectRatio(UIImage(named: "sweetner")!.size, contentMode: .fit)
HStack {
Image("plus-icon")
Spacer()
Image("comment-icon")
Spacer()
Image("headset-icon")
}.padding()
HStack {
Text(post.user.userName)
Spacer()
Text(post.textContent)
}.padding()
}
}
}
PostsView
import SwiftUI
struct PostsView: View {
@ObservedObject var fbVM = FirebaseInfo()
var body: some View {
List(fbVM.visiblePosts) { post in
PostView(post: post)
}
}
}
struct PostsView_Previews: PreviewProvider {
static var previews: some View {
PostsView()
}
}