Swift UI - Xcode
Problem: I have extra cells when my list is initialized. However, unlike other posts I do not have a navigation view. Is it mandatory to have a NavigationView in order to remove the extra cells from my list.
I have tried to implement a Navigation View but im not sure if its mandatory and how to properly implement.
.navigationBarTitle("List")
.listStyle(GroupedListStyle())
I would like to start a new Text or UIButton directly below the last "Current" cell without extra white spaces.
var body: some View {
VStack(alignment: .leading) {
Image("covidImage")
.resizable()
.aspectRatio(contentMode: .fit)
.cornerRadius(5)
Text("COVID DATA")
.font(.system(.title, design: .rounded))
.bold()
.lineLimit(3)
.padding(.bottom, 3)
.padding(.leading, 10)
Text("Represented by Sate in the United States")
.font(.subheadline)
.foregroundColor(.secondary)
.padding(.leading, 10)
.padding(.bottom, 0)
Text("Current State: CA")
.font(.subheadline)
.foregroundColor(.secondary)
.padding(.leading, 10)
.padding(.bottom, 10)
//List to Initialize TableView Data
List(covid) { covidData in
Image(systemName: "photo")
.padding()
HStack {
Text(covidData.dataTitle).frame(maxWidth: .infinity, alignment: .leading)
Text(covidData.dataValue)
.font(.subheadline)
.frame(maxWidth: .infinity, alignment: .trailing)
//.color(.gray)
}
}//END List
}//END Original VStack
}//END Some View
UITableView.appearance().separatorColor = .clear e.g after END List add
.onAppear { UITableView.appearance().separatorColor = .clear }` – Norman