Lacks MacOS support

I bought the digital version of “SwiftUI of Tutorials” book ($59.95) because the website specifically states Build modern, responsive UI and animations that look great on iOS, iPadOS, watchOS, tvOS or even macOS!

This book contains virtually nothing for the MacOS platform. I was looking for help on including a NSTableView in a MacOS SwiftUI app. Chapter 15 explains adding a custom control to an iOS SwiftUI app, but never mentions adding it to a MacOS app. Any chance on getting my $60 back?

2 Likes

I also hope more MacOS native stuff will be added.
Maybe at least one chapter exclusively focused on macOS development so we can see the differences.
I though this book will help with UI stuff on all platforms and especially on macOS(because the number of resources for this platform is much more limited than on others).

1 Like

I agree with you, but I also must add a followup to my previous, rather negative book review:

I did if fact follow the book, built the apps and I did get some good info so it was not a complete waist of money.

My main problem I have had since converting to Apple from Microsoft is the very limited documentation, books, tutorials, etc. that concentrate on the MacOS environment. Seams like nearly everybody writes/developes for the iOS but not MacOS. That problem now continues for SwiftUI. :frowning:

Have a good day

2 Likes

FWIW, Apple recently published a tutorial on creating macOS apps with SwiftUI.

I haven’t gone through it yet, but it looks pretty solid.

1 Like

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 description
  • Step 8: shows only 2 closing braces after padding, frame, offset instead of 3
  • Step 9: forgot to add import MapKit

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.

1 Like

Thank you for the update. I do like some of the ideas behind SwiftUI and want to stay informed about its progress. But for now, I have given up trying to use it for MacOS development. I make extensive use of multi-column NSTableViews of which SwiftUI appears to have no equivalent. And, IMO, going the “representable” route makes for a awkward program attempting to mix two different programing paradigms.

I hope Apple will continue the development of SwiftUI to the point it can stand on its own.

1 Like

With the new additions in macOS11 and iOS14 SwiftUI will get much more fitting for mac development. I hope that this aspect will be part of the updated book in the future.

1 Like

We need an article about converting from iOS to MacOS. Surely someone here who has experience programming specifically for MacOS could write something for learners who want to get started. Why waste a subscription on this site if we cannot get our needs met?