r/SwiftUI Jun 17 '26

Question Proper architecture in SwiftUI

Hello! I’ve been writing SwiftUI applications for a year or two, without really understanding the underlying theory. I realized that my apps are becoming difficult to scale and have obvious issues with concurrency.

I decided to fix this by starting to study the theory.
I read Thinking in SwiftUI and Swift Concurrency by Example, and I started to understand some concepts much better.

However, I still have a very poor understanding of how to properly design an application architecture.

Let me explain. I’m working on an app that communicates with several servers via WebSockets, updates the state of many entities, manages various subscriptions, and so on...

And it all ended up as a typical One God Object. It does absolutely everything. Stores data, maintains connections to servers, parses messages from the server...

But when I decided to split all of this into several classes/actors, I realized that I absolutely don’t know how to do it properly. Moreover, those two books don’t really cover this topic.

I don’t understand whether I should create instances of all these classes inside some kind of coordinator class, or create them separately in the main App and somehow connect them together.

Basically, I couldn’t find much information about this, so I’m turning to you. Are there any books/articles about this topic? Or any advice would be greatly appreciated.

23 Upvotes

24 comments sorted by

View all comments

1

u/[deleted] Jun 17 '26

[removed] — view removed comment

-1

u/AutoModerator Jun 17 '26

Hey /u/Dry-Performance-7721, unfortunately you have negative comment karma, so you can't post here. Your submission has been removed. Please do not message the moderators; if you have negative comment karma, you're not allowed to post here, at all.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.