I'm building an app using SwiftUI that is centered around a list of articles which are either a new standalone topic, or which have a hierarchical relationship with an ancestor which was originally one of those new standalone topics.
The default view in the List{} structure shows just the titles of the articles, but when tapping on an entry which shows the threaded titles, they're all expanded, via the following logic:
if showDetail {
ForEach(self.articles, id: \.self) { article in
VStack {
if article.id != self.articles[0].id {
Text(article.title)
.font(.caption)
.lineLimit(3)
}
Text(article.summary)
.lineLimit(20)
}
}
} else {
ForEach(self.articles, id: \.self) { article in
if article.id != self.articles[0].id {
Text("• \(article.title)")
}
}
}
And it works great! Except for one thing: when expanded, the encompassing view gets enough padding at the top and the bottom for several lines of text.. If I drop the article summary's .lineLimit to 1, the padding goes away, but at 3 and above the extra padding is visible and continues to grow until at 20, I get effectivley something like 5-7 blank lines at the top and the bottom.
Anyone else seen this? I'm considering filing a radar, but I want to make sure this isn't expected behavior first.