1

I have been racking my brain trying to figure out what is causing this and I am assuming it has to do with where the NavigationView is located.

To add context, I have a view that we will call View A which contains the NavigationView. In View A there is a toolbar with a navigation link that calls View B where the below code snippet is located. When the picker below is clicked it moves to a view to select the picker option, but upon clicking an option it returns to View A and not View B.

Adding an additional NavigationView wrapping this form does fix the issue, but is not what I would call ideal since it adds additional title bars.

//The following form contains all of the form components to compose the add MetaList View
        Form{
            
            Section {
                TextField("MetaList Name", text: $newMetaListName)
            }
            
            Section(header: Text("Description")){
                TextEditor(text: $newMetaListDescription)
            }
            
            //The following section contains the picker to determine the type of list being created
            Section {
                Picker("MetaList Type", selection: $metaListType) {
                    
                    //The following for each utilizes the Enum detailed in MetaListModels to create an item for each case
                    ForEach(MetaListTypes.allCases) { metaListType in
                        Text(metaListType.name).tag(metaListType)
                    }
                }
            }
            
            //The following is a placeholder section for future tags
            Section(header: Text("Tags")){
                
            }
            
            Button(action: {
                if newMetaListName.isEmpty {
                    metaListNameBlank = true
                } else {
                    metaListNameBlank = false
                    addMetaList()
                }
            }) {
                Text("Submit")
            }
#if os(iOS)
            .alert("Name Field Cannot Be Left Blank", isPresented: $metaListNameBlank) {
                Button("OK", role: .cancel) { }
                
            }
#endif
            .padding()
        }
        .navigationTitle("Create New MetaList")
    }

I super appreciate any help because I am not quite sure what else to try.

Livy M
  • 11
  • 3

0 Answers0