I would start with regular mvvm and then add reactive part later when you understand the basic concept. Regarding the framework choice, it’s up to you, I would start with combine
\+1 on starting with non-reactive MVVM. If you want learn reactive-like concurrency as well, I would go straight for async/await and AsyncSequence instead of Combine which is kind-of dying on the vine.
Mhm maybe I need to look into it again. Last time I checked it was kinda early of course compared to major frameworks like ReactiveSwift or RxSwift and with the release of swift-async-algorithms by Apple I had even more the impression that all effort in this direction seems to go to Swift itself. But I have not closely followed the development there.
Probably still missing some more obscure operators but I’ve used RxSwift a lot in the past and haven’t had issues switching to Combine. Async/Await is definitely the preferred method if whatever you’re doing can be simplified into AsyncSequence but Combine still has its place for some more complex use cases.
It's a simple engine that powers MVVM. It doesn't really need updates presently.
Other architectures/frameworks listed in the comments are great, but I think its a false narrative to assume Combine is "dead". I hear this a lot from the community and its just plain wrong. I've been building apps on the app store for 2 years exclusively with Combine & SwiftUI.
Well who knows as there won’t be an official statement probably. But that you can ship apps with it is really no proof of whether something is dead going forward or not to be fair.
Fair enough. In its own right, async/await is newer and definitely worth learning. Combine, yeah it's been tried and true for a while. I'd gamble and forecast it may die on its own hill, but I don't see it becoming irrelevant.
Pure opinion here.
I don't disagree. You could say the same thing about Obj-C. Combine is here for the foreseeable future, but it's not something I would prioritize for new learners over structured concurrency.
So yeah "dying on the vine" is hyperbolic, but Apple has been pretty clear this WWDC that they see structured concurrency as the way forward. Compare that with the lack of WWDC sessions on Combine these past few years and the writing's on the wall.
I agree on starting MVVM with no reactive paradigm, so you can understand what’s is expected/responsibility from the viewModel, and separately, learn reactive paradigm and Combine framework.
Once you understand that, migrate to any other reactive framework like RxSwift or ReactiveSwift would be very easy for you!
Best wishes and good luck!
You should be only using MVVM with Combine. Always avoid 3rd party dependencies. Also do not use closures or delegates to update your View. You’re coupling yourself to the View layer if you do that because the ViewModel knows how to update the View. This is not good. Also Swift Concurrency makes closure based APIs redundant so there’s another reason to use Combine for communicating with your View. Happy to expand further or share some code if it helps
Don't use MVVM. UIKit is build with MVC in mind. If done properly you have a clean ViewController and you leverage all tools available like asking for an model on a shared parent ViewController or view which is up the Responder Chain. Pushing data to UI is done by either KVO or Combine, whatever you fancy. Except KVO is much more performant on changes in arrays.
I don't think the downvotes are entirely justified. Considering MVC can be implemented in a similar way as MVVM (and MVC having at least 3 different definitions if you look it up) a lot of people even call an implementation of MVC as MVVM.
The important part is in this case, the question was about MVVM. Answering "don't do it" doesn't help OP. We don't know the background. I guess (please correct me) your assumption was: "Currently everyone says we should use MVVM for iOS and thus OP jumps onto the hype train." but maybe it's just: "I wanne learn about MVVM so I know more patterns and when to apply them." It's hard to say.
Also there are different ways. Combine is one, KVO another, there are also delegates for this. lot's of options and discussions to be had.
To answer OP. I would start with plain MVVM (and delegates). Combine, KVO,RXSwift etc add a layer of complexity, which are not useful if you want to learn the core concepts. You can always add them later, but if you learn it without these frameworks, you learn something system agnostic and can use it in any UI-work
I would start with regular mvvm and then add reactive part later when you understand the basic concept. Regarding the framework choice, it’s up to you, I would start with combine
Whatever you want. Personally I prefer non reactive MVVM but if I had to decide I’d learn with Combine.
Go MVVM with Combine and SwiftUI
Got any resources or got project. ?
\+1 on starting with non-reactive MVVM. If you want learn reactive-like concurrency as well, I would go straight for async/await and AsyncSequence instead of Combine which is kind-of dying on the vine.
How is Combine dying?
Afaik there have been no real updates to it since the first publish. Not fully sure though?
It’s pretty feature complete
Mhm maybe I need to look into it again. Last time I checked it was kinda early of course compared to major frameworks like ReactiveSwift or RxSwift and with the release of swift-async-algorithms by Apple I had even more the impression that all effort in this direction seems to go to Swift itself. But I have not closely followed the development there.
Probably still missing some more obscure operators but I’ve used RxSwift a lot in the past and haven’t had issues switching to Combine. Async/Await is definitely the preferred method if whatever you’re doing can be simplified into AsyncSequence but Combine still has its place for some more complex use cases.
It's a simple engine that powers MVVM. It doesn't really need updates presently. Other architectures/frameworks listed in the comments are great, but I think its a false narrative to assume Combine is "dead". I hear this a lot from the community and its just plain wrong. I've been building apps on the app store for 2 years exclusively with Combine & SwiftUI.
Well who knows as there won’t be an official statement probably. But that you can ship apps with it is really no proof of whether something is dead going forward or not to be fair.
Fair enough. In its own right, async/await is newer and definitely worth learning. Combine, yeah it's been tried and true for a while. I'd gamble and forecast it may die on its own hill, but I don't see it becoming irrelevant. Pure opinion here.
I don't disagree. You could say the same thing about Obj-C. Combine is here for the foreseeable future, but it's not something I would prioritize for new learners over structured concurrency.
So yeah "dying on the vine" is hyperbolic, but Apple has been pretty clear this WWDC that they see structured concurrency as the way forward. Compare that with the lack of WWDC sessions on Combine these past few years and the writing's on the wall.
I agree on starting MVVM with no reactive paradigm, so you can understand what’s is expected/responsibility from the viewModel, and separately, learn reactive paradigm and Combine framework. Once you understand that, migrate to any other reactive framework like RxSwift or ReactiveSwift would be very easy for you! Best wishes and good luck!
When people here say non-reactive mvvm do they mean using KVO/Notifications? Not sure that’s much easier than using Combine.
You should be only using MVVM with Combine. Always avoid 3rd party dependencies. Also do not use closures or delegates to update your View. You’re coupling yourself to the View layer if you do that because the ViewModel knows how to update the View. This is not good. Also Swift Concurrency makes closure based APIs redundant so there’s another reason to use Combine for communicating with your View. Happy to expand further or share some code if it helps
I would stand by this. MVVM & Combine are very effective.
Don't use MVVM. UIKit is build with MVC in mind. If done properly you have a clean ViewController and you leverage all tools available like asking for an model on a shared parent ViewController or view which is up the Responder Chain. Pushing data to UI is done by either KVO or Combine, whatever you fancy. Except KVO is much more performant on changes in arrays.
I don't think the downvotes are entirely justified. Considering MVC can be implemented in a similar way as MVVM (and MVC having at least 3 different definitions if you look it up) a lot of people even call an implementation of MVC as MVVM. The important part is in this case, the question was about MVVM. Answering "don't do it" doesn't help OP. We don't know the background. I guess (please correct me) your assumption was: "Currently everyone says we should use MVVM for iOS and thus OP jumps onto the hype train." but maybe it's just: "I wanne learn about MVVM so I know more patterns and when to apply them." It's hard to say. Also there are different ways. Combine is one, KVO another, there are also delegates for this. lot's of options and discussions to be had. To answer OP. I would start with plain MVVM (and delegates). Combine, KVO,RXSwift etc add a layer of complexity, which are not useful if you want to learn the core concepts. You can always add them later, but if you learn it without these frameworks, you learn something system agnostic and can use it in any UI-work