Problem with VStack

I have the following code in my mainview:


var body: some View {
       
        NavigationView {
            List {
                NavigationLink(destination: CategoryoneList()) {
                    Text("1. ")
                }
               
                NavigationLink(destination: CategorytwoList()) {
                    Text("2. ")
                }
               
                NavigationLink(destination: CategorythreeList()) {
                    Text("3. ")
                }
               
                NavigationLink(destination: CategoryfourList()) {
                    Text("4. ")
                }
               
                NavigationLink(destination: CategoryfiveList()) {
                    Text("5. ")
                }
               
                NavigationLink(destination: CategorysixList()) {
                    Text("6. ")
                }
               
                NavigationLink(destination: CategorysevenList()) {
                    Text("7. ")
                }
               
                NavigationLink(destination: CategoryeightList()) {
                    Text("8. ")
                }
               
                NavigationLink(destination: MainList()) {
                    Text("9. ").bold().underline()
                }
               
                logo()
            }.navigationBarTitle("Overzicht", displayMode: .inline)
            .navigationViewStyle(DefaultNavigationViewStyle())
            .padding(0)      
        }
}


Now I want to add my ContactView (with mailadress and whatsApp) under my logo.


The problem is that my ContactView is not displayed or I get the error "Argument passed to call that takes no arguments" next to my first NavigationLink.


I already tried to put the different views in a VStack seperately, but with no result (first view with my list is not fully displayed).


I don't want to work with scrollview, because I want my whole list with navigationlinks fully visible.

Replies

Are you saying your code won't compile when you put another view under the `logo()`? If so, it may be because SwiftUI has a limit on the number of subviews. I forget the exact number but it's around 10, so you may have reached it. One way around around this is to put some views in a Group. Eg:


NavigationView {
  List {
    // Now these 4 children of List are only 1 child.
    Group {
      NavigationLink ...
      NavigationLink ...
      NavigationLink ...
      NavigationLink
    }

I hope this will be fixed in future. Maybe they need variadic generics to do it. And yes the error messages from the compiler are very bad, at least in Xcode 11.3. I'm hoping it's better in 11.4 but I haven't tried the beta.