SwiftUI with AppKit

As I first heard about SwiftUI I was totally excited. But I'm developing for macOS and not for iOS. Unfortunately, all the tutorials on the internet are for iOS. I didn't found even one example of using SwiftUI on macOS or with AppKit, even the apple documentation doesn't really write something useful about that. At the moment I'm really consternated, because I'm not getting forward building a project with SwiftUI. Did anyone find any tutorials for SwiftUI on macOS? Maybe Apple made that on purpose and it would be make more sense to just use Catalyst (because maybe AppKit will be replaced at some day?)

In my experience, most iOS examples works just fine with (non-catalyst) macOS projects. The difference are mostly visual (buttons look differently, etc.). I don’t even check the OS when I copied the code snippet over.

Integrating AppKit is also much the same as integrating UIKit, with difference in prefix.

Hi Lantua, thanks for your answer. There is for example no documentation on how to handle windows or how to use NSViewRepresentable (for example with a NSTableView). And SwiftUI in the current state doesn't really offer all the possibilities, that you can make with AppKit (for example a columned TableView with resizing and reordering etc.). Maybe it will never do that and as I'm standing in front of a bigger project, I think about what to choose (Storyboard, SwiftUI with AppKit or SwiftUI and Catalyst).

It's true that the documentation has been quite... lacking.

For the usage of ViewRepresentable in particular, you may want to check out this WWDC 2019 video - Integrating SwiftUI. I also find SwiftUI Lab to be very useful. I get most of the advance layout information I need there.

I'd still suggest SwiftUI since you'd get most modern features (dark mode, accessibility) for cheap. There are definitely things that SwiftUI currently do not support, and I doubt it ever will. An example includes key-frame animation. Given the declarative nature of the framework, I can't even imagine how that'd work.