I am a beginner with SwiftUI Layout (not in coding) and I have a problem
Here the code:
var body: some View {
NavigationView {
VStack {
Form {
TextField("Nome", text: $name)
}
.navigationBarTitle("Aggiungi Dispensa", displayMode: .inline)
.navigationBarItems(trailing: Button("Aggiungi") {
if self.name.count > 0 {
let item = DispItem(name: self.name)
self.dispense.items.append(item)
}
self.name = ""
})
List {
let sortedItems = dispense.items.sorted {
$0.name < $1.name
}
ForEach(sortedItems) { item in
Text(item.name)
.font(.headline)
}
.onDelete(perform: removeItems)
}
}
}
}
Basically is a VStack composed by Form and List But I do not understand where the empty space at the top comes from and the white space between Form and List.
Thanks Marco