I'm trying to add a list of items into a view, while having an icon above. Currently when I build my code it, it separates the icon and the list, which is what I'm looking for but it makes the icon static and the list scrollable. I want both icon and the list to move together.
let items = ["Text", "Text", "Text", "Text"]
struct SignInView: View {
var body: some View {
NavigationView {
VStack {
Image(systemName: "car.fill")
.font(.system(size: 40))
.foregroundColor(.blue)
.frame(width: 150, height: 150)
List {
ForEach(items, id: \.self) { item in
HStack {
Image(systemName: "house.fill")
.foregroundColor(.blue)
Text(item)
Spacer ()
Text("1")
Image(systemName: "chevron.forward")
.foregroundColor(.blue)
}
}
}
}
}.navigationBarTitle("Car", displayMode: .inline)
}
}