fixeds
This commit is contained in:
parent
6829e5db6c
commit
b2ce994cea
@ -19,12 +19,16 @@ struct EmployeeListView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
List {
|
List {
|
||||||
ForEach(viewModel.employees) { employee in
|
//build out dynamic rows first
|
||||||
|
ForEach(viewModel.employees, id: \.id) { employee in
|
||||||
NavigationLink(destination: EmployeeDetailsView(viewModel: .init(employee: employee))) {
|
NavigationLink(destination: EmployeeDetailsView(viewModel: .init(employee: employee))) {
|
||||||
EmployeeRowView(viewModel: .init(employee: employee))
|
EmployeeRowView(viewModel: .init(employee: employee))
|
||||||
}
|
}
|
||||||
|
.listRowInsets(.none)
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add static row if there is a next page
|
||||||
if viewModel.hasNextPage {
|
if viewModel.hasNextPage {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
@ -34,7 +38,7 @@ struct EmployeeListView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Employees")
|
.navigationTitle("Employees")
|
||||||
.listStyle(.plain)
|
.listStyle(.insetGrouped)
|
||||||
}
|
}
|
||||||
.task {
|
.task {
|
||||||
if viewModel.employees.isEmpty {
|
if viewModel.employees.isEmpty {
|
||||||
|
|||||||
@ -37,7 +37,6 @@ struct EmployeeRowView: View {
|
|||||||
|
|
||||||
Spacer() // Pushes everything to the left
|
Spacer() // Pushes everything to the left
|
||||||
}
|
}
|
||||||
.padding(.vertical, 8)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user