Following the advice from the great John Sundell ( https://www.swiftbysundell.com/articles/how-swift-5-3-enhances-swiftui-dsl/ ) a colleague and I were trying to refactor some code to take advantage of new features in Swift 5.3 and take advantage of the view builder changes that would allow us to remove some of the AnyView casting we were doing.
The application is a mixed iOS and macOS app compiled with Xcode 12.0.1 on macOS (Catalina [my coleague] and Big Sur beta 9 [me]).
We noticed that this will not work unless we manually add the @ViewBuilder annotation before of the body property and we thought this would not be needed as it was treated as a special case and inherit the ViewBuilder was inferred by the compiler ( https://developer.apple.com/wwdc20/10170 ):
As you can see only one of the two cases compiles. Are we missing something obvious or bloody obvious :)?