I worked through it yesterday. Most of it is equally valid for iOS, although it sets max frame width and similar, which you don’t need for iOS.
The other main difference is using compiler directives to specify NSRepresentable vs UIRepresentable for MapView.
There are a few typos in Section 9:
- Step 7:
detail should be
- Step 8: shows only 2 closing braces after padding, frame, offset instead of 3
- Step 9: forgot to add
There are still a number of warnings when you build and run, for example:
=== AttributeGraph: cycle detected through attribute 86 ===
2020-02-06 12:00:57.458941+1100 MacLandmark[7380:329339] [SwiftUI] NSHostingView is being laid out reentrantly while rendering its SwiftUI content. This is not supported and the current layout pass will be skipped.
You need the very latest macOS version, although the deployment target menu doesn’t show sub-versions.
All this hints at the reason I didn’t do more macOS stuff in Chapter 5 — it just didn’t work the way they showed in WWDC videos. I assume Apple prioritised getting SwiftUI working for iOS, as that’s the biggest market. Now that they’re working on macOS, I’ll definitely be taking a closer look.