SwiftUI MVVM Tutorial: Simple Example with ObservableObject

preview_player
Показать описание
This SwiftUI MVVM tutorial uses ObservableObject to walk through a simple example of MVVM SwiftUI App Architecture. MVVM uses a Model, View, and ViewModel to allow for efficient development within teams, overall clean code, and is one of the most popular iOS design patterns. In this tutorial, we create and update a SwiftUI List of Game of Thrones characters using this method. This tutorial uses Xcode 13 and Swift 5.5.

Want to see more?

#SwiftUI #MVVM #SwiftUITutorial #iOS15 #AppArchitecture
Рекомендации по теме
Комментарии
Автор

This is the only basic mvvm tutorial for beginners and believe me I searched all the internet in different languages, thanks man this helped me a lot, keep doing it 👍

mustafaokay
Автор

Thank you. I come from a .NET background with desktop publishing, so I was looking for an MVVM tutorial. So. Many. People. don't understand well enough to explain it well. That being said, as the rest of the comments suggest, well done sir, well done. Exactly what I needed.

williams.
Автор

Great introduction into the concept. Thank you!

DmitriyChurilov
Автор

Very clear and simple, thank you man!

SantiLucero
Автор

You sir, had by far the most understandable video in the subject. Thank you. I will be subscribing and recommending your channel to others trying to learn.

TidalWaveDan
Автор

That was great, exactly what I needed and simple to understand.

jamesmeegan
Автор

this tutorial was so cool, i understood concepts better ....

joaquimmenezes
Автор

At 5:30 timestamp, you add the ObservableObject Protocol. Using Swift 5 and Xcode 14.1 I get an error there. Basically it wants to add a Generic Type to the Observable object.When I add <Person> it says this is not confirm to ObservableOBject Protocol. Can't proceed further till this is resolved. So pls help.
Also I get an error when I use the Identifiable Protocol.

kevindesouza
Автор

Nice video. I´m just wondering, is there a reason for ViewModel to be a class and not a struct? you could use @State in the view make viewmodel a struct and handle inheritance with protocols if needed. Why would you need a reference to the viewmodel and not a copy of its values?

arturoescutialopez
Автор

Very well explained, thank you Sir, simple but effective. Please keep up the good work. 👏

MrDaluti
Автор

How can I change the array with a button. like if Jon Snow change his email and wanna change this in app how can I do that ?

SOK-gnhw
Автор

ObservedObject occasionally works sometime. sometime doesn't and shouldn't.
It should be StateObject in all similar cases. As for me, it's very clearly described in apple documentation.

AntiSmithhh
Автор

ur light-mode just mademy day brighter and eyes darker😜 btw, thanks a lot sensei 🤝

ob
Автор

i wanna ask something, where are those function come from? the people.reverse and the others.. i dont see it.. mind to explain, please??

ob
Автор

Nice man! Thanks for all the great content

dmitrygolovin
Автор

How would you use this approach to access the same data across multiple views, do you require the environment object at that point?

johnpill
Автор

Great example!. can you please a short MVVC video tutorial for fetching API data CRUD[create, get, update, delete]?

ForhadDreams
Автор

Finally a simple example and not unnecessarily complicated. Thanks! I experimented a bit with the code. The array is updated in the view, but if I change the name of a person, the view is not updated. What do I have to do to make this data binding work?

franziskaschneider
Автор

HI, just learn of this mvvm model based on @observable object, this is new to me, thanks for the tutorial... but I need to goto detail view if I tap/click on each view model, could you help ? (pointing to which info to pass )
because I don't know how to pass data ( each of model <person in> ) to the detail view model ( how to declare variable), thanks

anhhanry
Автор

Hi, wouldn't it make more sense to have the people array inside a model and not the viewModel.
let's say you have different sets of potential People array. The viewModel will load them in the constructor based on the array you want. What I mean is that the viewModel should have the possibility to load a lot of different models and not include hard coded values?

TheShambi