I am trying to learn swiftui and faced with "markup" problem. I need to build a UI with textfield in a toolbar (like address line in Safari):
I've tried to do it like this:
import SwiftUI
struct ContentView: View {
@State var searchText: String = ""
var body: some View {
NotesListView(notesRepo: InMemoryNotesStubRepository())
.frame(minWidth: 500, minHeight: 300)
.toolbar {
ToolbarItem(placement: .primaryAction){
TextField("Search", text: $searchText)
.frame(minWidth: 300)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
And I've got something weird:
Can anyone help me how to add a textfield to a toolbar like in is in Safari (address line)?

