Hi there,
I would like to implement a search bar into my existing list, filled with NavigationLink
s. Is there a possibility to mark all my existing NavigationLink
s with variables that I can show them in my search list?
I am still quite new to SwiftUI so I would love to hear from you.
Here is my code:
var body: some View {
NavigationView {
List {
Group {
NavigationLink(destination: MidazolamLink()){
Image("MidazolamMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Midazolam")
}
NavigationLink(destination: NaloxonLink()){
Image("NaloxonMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Naloxon")
}
NavigationLink(destination: ParacetamolLink()){
Image("ParacetamolMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Paracetamol")
}
NavigationLink(destination: PrednisolonLink()){
Image("PrednisolonMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Prednisolon")
}
NavigationLink(destination: SalbutamolLink()){
Image("SalbutamolMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Salbutamol")
}
NavigationLink(destination: SauerstoffLink()){
Image("SauerstoffMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Sauerstoff")
}
NavigationLink(destination: UrapidilLink()){
Image("UrapidilMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Urapidil")
}
NavigationLink(destination: VollelektrolytloesungLink()){
Image("VollelektrolytloesungMediLabel")
.resizable()
.frame(width:60, height: 30)
Text("Vollelektrolytlösung")
}
}
}
.background(Color.clear)
.listStyle(SidebarListStyle())
.navigationTitle("Medikamente")
.toolbar {
NavigationLink(destination: About()){
Image(systemName: "info.circle")
}
NavigationLink(destination: Settings()){
Image(systemName: "gear")
}
}
BackgroundMedikamente()
}
}
}
Thank you so much for your help!
Laurin
You're apparently new to the forum, so welcome.
You should not repeat the same question several times.
I answered in the other thread (https://developer.apple.com/forums/thread/740636), see it there.
And please close this thread which is duplicate.