Thanks for your answers!
@WeagleWeagle That would be a good Idea, unfortunately I have even more NavigationStacks in the detailed description of the medications. Any idea how I could fix that? I need to Link the details from other pages aswell.
Thank you so much!
Laurin
Post
Replies
Boosts
Views
Activity
@Dirk-FU Thanks for your answer. What do I have to put into the code that it will work?
Laurin
Thank you for your answer, @Claude31 . Here is my code. The problem is that I have no variables. Can I implement them?
Laurin
var body: some View {
NavigationView {
List {
Group {
Section (header: Text("Grundlagen")){
NavigationLink(destination: StandardVorgehenInvasiveMassnahmen())
{
Label {
Text("Standardvorgehen bei invasiven Maßnahmen")
} icon: {
Image(systemName: "list.bullet.clipboard")
}
}
}
Section (header: Text("Zugang")){
NavigationLink(destination: ivZugang())
{
Label {
Text("i.v.-Zugang")
} icon: {
Image(systemName: "syringe")
}
}
NavigationLink(destination: ioZugangEZIO())
{
Label {
Text("i.o.-Zugang: EZ-IO® / COOK® / BIG®")
} icon: {
Image(systemName: "syringe.fill")
}
}
NavigationLink(destination: ioZugangFAST1())
{
Label {
Text("i.o.-Zugang: FAST1®")
} icon: {
Image(systemName: "syringe.fill")
}
}
}
Section (header: Text("Extraglottischer Atemweg")){
NavigationLink(destination: extraglottischerAtemweg())
{
Label {
Text("Extraglottischer Atemweg")
} icon: {
Image(systemName: "lungs")
}
}
NavigationLink(destination: extraglottischerAtemwegLTSD())
{
Label {
Text("Extraglottischer Atemweg: LTS-D®")
} icon: {
Image(systemName: "lungs.fill")
}
}
NavigationLink(destination: Larynxmaske())
{
Label {
Text("Larynxmaske mit Drainagekanal")
} icon: {
Image(systemName: "lungs")
}
}
NavigationLink(destination: extraglottischerAtemwegIGEL())
{
Label {
Text("Extraglottischer Atemweg: i-gel®")
} icon: {
Image(systemName: "lungs.fill")
}
}
}
}
Section (header: Text("Weitere invasive Maßnahmen")){
Group {
NavigationLink(destination: LaryngoskopieMagillzange())
{
Label {
Text("Laryngoskopie / Magillzange")
} icon: {
Image(systemName: "lungs")
}
}
}
}
}
.listStyle(SidebarListStyle())
.navigationTitle("Maßnahmen")
.toolbar {
NavigationLink(destination: About()){
Image(systemName: "info.circle")
}
}
BackgroundMassnahmen()
}
}
}
I found a solution: You just have to set
.navigationTitle("Acetylsalicylsäure")
.navigationBarTitleDisplayMode(.inline)
a bracket lower. So one more closed bracket before the mentioned text and one less after it. :)
@shipty Thank you for your answer! Unfortunately the result did not look as I hoped. I found a solution. Instead of using ScrollView I could use Form, like this:
@AppStorage("MediAnsicht") var MedisEinfacheAnsicht = false
var body: some View {
if MedisEinfacheAnsicht == true {
Form {
Section {
Image("AcetylsalicylsaeureMediLabel")
.resizable()
.scaledToFit()
NavigationLink(destination: AcetylsalicylsaeureSAA()){
Text("SAA anzeigen")
.foregroundColor(Color("SAAColor"))
}
}
AcetylsalicylsaeureAllgInfos()
AcetylsalicylsaeureKontraind()
AcetylsalicylsaeureUAWs()
AcetylsalicylsaeureInd()
AcetylsalicylsaeureDurchDo()
AcetylsalicylsaeureAltBeg()
AcetylsalicylsaeureBesond()
AcetylsalicylsaeureVerlKon()
AcetylsalicylsaeureErfPr()
AcetylsalicylsaeureFoMass()
}
} else {
AcetylsalicylsaeureMenu()
}
}
}
When I use ScrollView, it looks like this:
With Form it looks like this:
But thank you so much for your help! :)
Laurin
@Claude31 Thank you for your answer! As you know I am really new to this all and I have this error message:
What am I doing wrong?
Best, Laurin
@sha921 Thank you very much for your help. I still have got some problems. I implemented the code as you said, but unfortunately I still do not get any results when I try to search something. Furthermore I don't know how I can link the results to already existing views with NavigationLink. Could you help me once more?
Thanks! Here is my code:
let medicList = ["Acetylsalicylsäure",
"Amiodaron",
"Atropin",
"Butylscopolamin",
"Dimenhydrinat",
"Dimentinden",
"Epinephrin",
"Esketamin",
"Furosemid",
"Glucagon",
"Glucose",
"Glyceroltrinitrat",
"Heparin",
"Ibuprofen",
"Ipratropiumbromid",
"Lidocain",
"Midazolam",
"Naloxon",
"Paracetamol",
"Prednisolon",
"Salbutamol",
"Sauerstoff",
"Urapidil",
"Vollelektrolytlösung"]
@State private var searchText = ""
var body: some View {
NavigationView {
List (medicList, id: \.self) { medic in
NavigationLink {
Text(medic) //destination here
} label: {
Text(medic)
}
}
.navigationTitle("Medikamente")
}
.searchable(text: $searchText)
}
var searchResults: [String] {
if searchText.isEmpty {
return medicList
} else {
return medicList.filter { $0.contains(searchText) }
}
}
}
Hi @sha921 ,
thank you again for your help. Unfortunately I have a few problems implementing your code:
-> When I use NavigationStack instead of NavigationView, it looks like this:
The reason for this is, that I implemented a background for iPad use, where it should look like this:
How can I implement this with NavigationStack?
-> The other problem is, that it looks like this, when I move the Section inside the loop:
I moved the Section directly underneath the if statement, like this:
ForEach(bprs, id: \.self) { bpr in
Section (header: Text("Herangehensweise")){
if bpr.contains("basismaßnahmen") {
Is that wrong?
Thank you for your help!
Laurin