Chapter 9 starter doesn't compile on Xcode 11.2 beta (11B41)

Get a Type of expression is ambiguous without more context compiler error when opening the starter project and building.

Hi Daniel! try wrapping the body (from if showHome) in a NavigationView. I wrote a note on page 49 about this.

That worked, but I had to remove the @ViewBuilder attribute as well

I didn’t, but just now, I had to be very insistent to make the preview work. This MacBook just updated to 10.15.1, and I’m not using Xcode beta.

I had to remove the ViewBuilder attribute too in order for that to work. I think it’s that attribute causing the problem, because I’ve tried replacing the NavigationView with an HStack and it works.

In the original version of the code, that attribute is needed because the body is a multi statement instead of a single root view. By embedding that code in a container view, the @ViewBuilder attribute is no longer needed.

However another way to solve the issue is by using the init(verbatim:) initializer for the Text. It looks like the Text(_:) initializer is unavailable when used in a view builder closure - presumably a bug.

Note: tested with Xcode 11.2