I have the following code written using SwiftUI 2.0, Xcode 12.0 beta 5 on OS 11 beta 5.
The issues are the the following:
Code Block swift struct ContentView: View { var body: some View { GeometryReader { geometry in List { ForEach(data, id: \.id) { article in ArticleCell(article: article) } .frame(width: geometry.size.width) .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0)) } .listStyle(PlainListStyle()) } } }
Code Block Swift struct Article: Identifiable { let id: String let title: String let description: String } let data = [ Article( id: UUID().uuidString, title: "Title 1", description: "NASA has awarded the Strategic Research and Analysis, Communications, and Exhibits Services (SRACES) contract to Media Fusion LLC of Huntsville, Alabama, to provide comprehensive strategic research and analysis, communications, and exhibits services at the agency’s Marshall Space Flight Center in Huntsville, Alabama." ), Article( id: UUID().uuidString, title: "Title 2", description: "Girl Scouts from across the nation will pose questions next week to NASA astronaut Chris Cassidy aboard the International Space Station." ) ];
Code Block swift struct ArticleCell: View { let article: Article var body: some View { VStack(alignment: .leading, spacing: 8) { Text(article.title) .font(.title) Text(article.description) .font(.body) .lineLimit(3) .multilineTextAlignment(.leading) .fixedSize(horizontal: false, vertical: true) } } }
The issues are the the following:
The article views are sized beyond the size of the cell and are clipping.
The padding fluctuates in the text controls
There is no separator in the cell (at least in dark mode)
Cells are leading aligned like they are told in the VStack.