This is a screenshot of an existing app created using UIKit. This is an in internal issue tracker app. There is an issue number on the left. The right panel consists of the issue title, issue description, posted details, status.
My model is a struct called Issue, with properties id (for issue number), title, description, postedBy, postedDate and status.
I'm struggling to create this in SwiftUI, especially with the modifiers. I don't need the final result to be exactly the same as before, similar is good enough.
Here is what I have now:
struct ContentView: View {
var body: some View {
NavigationView {
List {
ForEach(Issue.example) { issue in
NavigationLink(destination: IssueView(issue: issue)) {
IssueRow(issue: issue)
}
}
}
}
}
}
struct IssueRow: View {
var issue: Issue
var body: some View {
HStack {
Image(systemName: "\(issue.id).circle")
.frame(width: 30, height: 30)
.padding()
.background(Color.blue)
.clipShape(Circle())
VStack {
Section(header: Text(issue.title)
.padding(), footer:
Text("Posted by \(issue.postedBy) on \(issue.postedDate)")
.padding()
) {
Text(issue.description + "~")
.padding()
}
}
.listStyle(GroupedListStyle())
}
}
}
This produces the following result: