I am trying to use SwiftUI in my pet project and get some strange behaviour:
If I put more than ten subviews into VStack/HStack/ScrollView/List, I got error "Extra argument in call", but there is no extra argument (actually, I get this error if I just add 11 Text("Hello, world!"))
If I put List into ScrollView, this list is not rendered (just empty space instead it), but there is no any error/warning/log messages (like for wrong constraints)
Thanks, Alex
It is a know limitation of the current implementation of SwiftUI. The Swift language currently does not support variadic generic parameters. So, in the implementation @ViewBuilder, can only get 10 arguments.
If I put more than ten subviews into VStack/HStack/ScrollView/List, I got error "Extra argument in call", but there is no extra argument (actually, I get this error if I just add 11 Text("Hello, world!"))
That Text("Hello, world!") definitely is the extra argument. All the views declared in VStack/HStack/ScrollView/List... are passed to a hidden method, each view as an argument.I get this error if I just add 11 Text("Hello, world!")
This is another known issue.If I put List into ScrollView, this list is not rendered (just empty space instead it), but there is no any error/warning/log messages (like for wrong constraints)
You can find some articles searching with "swiftui list in scrollview".
List hides when adding in ScrollView SwiftUI
(Seems this is not as famous as the 10-view-limitation.)
You can send some feedback about these issues, whether they are known or not.