That is the kid element:
import SwiftUI
struct CourseCell: View {
var course: Course
var physique: some View {
HStack(spacing: 12){
Picture(systemName: "particular person.circle.fill")
.resizable()
.body(width: 48, top: 48)
.foregroundStyle(Shade(.systemGray5))
VStack(alignment: .main, content material: {
Textual content(course.identify)
.font(.subheadline)
.fontWeight(.semibold)
Textual content(course.description)
.font(.footnote)
})
Spacer()
Picture(systemName: "chevron.proper")
.foregroundColor(.grey)
}
.body(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/)
.contentShape(Rectangle())
}
}
#Preview {
ForEach(programs){ course in
CourseCell(course: course)
}
}
That is the mother or father element:
import SwiftUI
struct CoursesView: View {
var physique: some View {
NavigationStack {
ScrollView() {
LazyVStack() {
ForEach(programs) { course in
NavigationLink(vacation spot: FeedView()) {
CourseCell(course: course)
.padding(.horizontal)
.foregroundColor(.main)
}
}
}
}
.navigationTitle("Programs")
.navigationBarTitleDisplayMode(.inline)
}
}
}
#Preview {
CoursesView()
}
I attempted placing it in chatgpt and it had no thought. All the pieces appears proper. There aren’t any international kinds as properly. The CourseCell is a customized view that shows course info, and it is used inside CoursesView which is a scrollable record of those cells. Based mostly in your description and the offered code, the whole lot appears structurally appropriate.