How to fix âAmbiguous reference to member 'buildBlock()'â
2022ë
12ì 1ìŒAbout 2 min
How to fix âAmbiguous reference to member 'buildBlock()'â êŽë š
SwiftUI by Example
Back to Home
How to fix âAmbiguous reference to member 'buildBlock()'â | SwiftUI by Example
How to fix âAmbiguous reference to member 'buildBlock()'â
Updated for Xcode 15
SwiftUI allows up to 10 static children in each container, so if you try to add 11 or more youâll get this error. To be clear, this means the following code is valid:
VStack {
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
}
But if you add a single more Text("SwiftUI")
then the code will refuse to build.
To fix this problem, wrap your items in groups of 10 or fewer, like this:
VStack {
Group {
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
}
Group {
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
Text("SwiftUI")
}
}
Similar solutionsâŠ
How to fix âCannot assign to property: 'self' is immutableâ | SwiftUI by Example
How to fix âCannot assign to property: 'self' is immutableâ
How to fix âModifying state during view update, this will cause undefined behaviorâ | SwiftUI by Example
How to fix âModifying state during view update, this will cause undefined behaviorâ
How to fix âProtocol 'View' can only be used as a generic constraint because it has Self or associated type requirementsâ | SwiftUI by Example
How to fix âProtocol 'View' can only be used as a generic constraint because it has Self or associated type requirementsâ
How to fix âFatal error: No ObservableObject of type SomeType foundâ | SwiftUI by Example
How to fix âFatal error: No ObservableObject of type SomeType foundâ
How to fix âCannot convert value of type 'String' to expected argument type 'Binding'â | SwiftUI by Example
How to fix âCannot convert value of type 'String' to expected argument type 'Binding'â