Looking for advice on app architecture

I have an existing Mac app which has evolved through over twenty years of development. It is currently written in a mixture of C++ and Objective-C, with a bit of C and Swift in a few places. For a few years now, I have been tinkering with replacing the UI with SwiftUI. The model has been completely rewritten in Swift and works fine. After a few tries, no version has been working acceptably, so I'm thinking that I need to rethink the architecture.

The UI consists of a window with a master-detail view. The detail view is what users spend most of their time with. It contains a lot of subviews, around 100 typically. Keyboard events affect the display, so I've had a dedicated data structure to hold the state that is needed for displaying all the subviews. Using Instruments, I see that the view seems to recreate the subviews three times per keyboard event, so I'm clearly doing something wrong.

A second factor is that there are a couple of dozen commands that are applicable to the detail view, driven either by menu items, keyboard shortcut, or toolbar button. Adding all of those to the view makes for a massive SwiftUI View, which seems unlikely to be good practice. The current implementation has the controller class broken up with categories, but still they are big classes.

Most SwiftUI stuff on the web is iOS-oriented, and typically has a focus on fairly simple apps, so the whole topic of dealing with menu commands doesn't get a lot of coverage, so I've been doing all that through my own solutions, which are probably nothing like optimal.

What I've been able to find is not particularly helpful for a full-fledged application like mine, so I'm looking for advice on how to structure the app. The existing one is largely MVC, but I've tried a similar approach and a shot at MVVM, but I'm not getting good results so far.

So, pointers, places I can read more, or samples of real-world apps is what I'm after. Anyone?

Using Instruments, I see that the view seems to recreate the subviews three times per keyboard event, so I'm clearly doing something wrong.

Not necessarily

Most SwiftUI stuff on the web is iOS-oriented, and typically has a focus on fairly simple apps, so the whole topic of dealing with menu commands doesn't get a lot of coverage

Correct

What I've been able to find is not particularly helpful for a full-fledged application like mine, so I'm looking for advice on how to structure the app.

You don't have to use SwiftUI.

Nice to know that I'm not alone. SwiftUI does make sense for the subviews, so I'll probably try to make the main view with AppKit. It will be an interesting challenge.

I've been able to develop pretty complex apps for Mac in SwiftUI, but in fact it is more iOS looking than genuine Mac app. In particular, I do not try to use menus.

SwiftUI is great to rapidly develop an app (noting that full fledge Mac App with AppKit is pretty complex).

But for sophisticated apps, I feel AppKit much more suited.

I wonder if Excel could be developed fully in SwifUI. IMHO, I don't think so.

I agree that SwiftUI is not the best to develop complex Mac apps.

I have developed some, but they are iOS looking, not MacOS.

So, for complex apps, I do prefer AppKit.

I wonder if an app like Excel could be developed fully with SwiftUI. IMHO, no. But I would be pleased to be proved wrong.

I agree that SwiftUI is not the best to develop complex Mac apps.

I have developed some, but they are iOS looking, not MacOS.

So, for complex apps, I do prefer AppKit.

I wonder if an app like Excel could be developed fully with SwiftUI. IMHO, no. But I would be pleased to be proved wrong.

I agree that SwiftUI is not the best to develop complex Mac apps.

I have developed some, but they are iOS looking, not MacOS.

So, for complex apps, I do prefer AppKit.

I wonder if an app like Excel could be developed fully with SwiftUI. IMHO, no. But I would be pleased to be proved wrong.

I agree that SwiftUI is not the best to develop complex Mac apps.

Sorry for the multiple posts and the inconvenience ! But when I clicked reply, nothing appeared in the page, so I retyped the message a few times.

Looking for advice on app architecture
 
 
Q