MacOS with SwiftUI, is it was a good choice?

Hi everybody,
first of all, I would like to thank @rwenderlich and his team, starting from @sarah for the book MacOS by Tutorial. I’ve been waiting for it for a long time. And now I’m starting to study it.

But I’ve a question about the use of SwiftUI to develop for macOS. Sure, SwiftUI is a UI Framework with grate potential. and I know well that APPKit is very very hard to master. But, as happen in iOS, SwiftUI unfortunately doesn’t give you the customization that UIKit has. and if it is true for ios, how much more is it true for Appkit. so this is question: leaving aside issues such as multi-platform, lack of constraints, plain language etc. is good idea develop an app in swiftUI? With SwiftUI you can create an app like, for example, XCode?

(I’m don’t talking about the features. I’m talking strictly about UI)

Hi,

I don’t think it is realistic (yet) to build a large-scale macOS app in SwiftUI alone. But I would always start now with SwiftUI and add AppKit components as needed. I think that is easier than the other way around.

Thinking about an app like Xcode, the main issue here would be the code editor itself. SwiftUI does not yet have a text editor with the power of an AppKit text editor view. But if that one pane was built in AppKit, I think the rest of the app could be made more easily in SwiftUI.

We are less than a month away from WWDC where I expect Apple to continue its trend of making more and more features available to SwiftUI. Any SwiftUI skills you learn now will only become more applicable as the framework expands.

Sarah

2 Likes

Hi @sarah, thank you very much for your answer.
and I understand well what you mean and effectively is a good idea. but if I need to insert AppKit component, where can i find documentation, tutorials on appkit components?

It is harder to find AppKit resources, but the good thing is that AppKit doesn’t change much, so even quite old tutorials will help you. If you search for “Mac” at https://www.raywenderlich.com, you’ll find a bunch of tutorials from back when there was a Mac section on the site.

My advice would be to start with SwiftUI and when you run into a problem, search specifically for help with that feature e.g. WebView, OutlineView or whatever. Don’t be put off by the age of the resources you find, so long as they are in Swift. Apple’s documentation can often get you started and then it’s like everything else - you have to experiment until it does what you want.

Hope this helps,
Sarah

Thank you very much @sarah. I will put your advice into practice. Effectly, the tutorials that are here in raywenderlich are a few old, but the real problem is, as you has said, is harder to find AppKit resources. MacOS has a big potential and it is disheartening not to be able to bring your ideas to life due to the fact that there is very little documentation. The idea of a book on MacOS was a great thing that I will be studying. I hope those articles on MacOS will be updated and accompanied by other equally interesting articles especially on AppKit.
Thank you @sarah

The following article provides a list of Mac development resources, both AppKit and SwiftUI:

Resources for Learning Mac Development

If you are looking for a SwiftUI text view that supports syntax highlighting, look at the CodeEditor Swift package.

NSViewRepresentable is the way to use AppKit views in SwiftUI apps. You will have more luck searching for UIViewRepresentable, which is the iOS equivalent. Most of the material on UIViewRepresentable applies to Mac. Replace the UI prefix with NS for Mac. The site Swift Dev Journal has articles that should help you with using SwiftUI on Mac.

2 Likes

This topic was automatically closed after 166 days. New replies are no longer allowed.