How to Use MVVM (Model View ViewModel) in Swift & iOS - 2023

  Рет қаралды 59,042

iOS Academy

iOS Academy

Күн бұрын

Пікірлер: 87
@multitudes389
@multitudes389 4 жыл бұрын
without zooming in and out all the time would be easier to follow. getting dizzy here 😀
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Haha thanks for the feedback. Newer vids have less zooming :)
@rishilund4120
@rishilund4120 3 жыл бұрын
@@iOSAcademy Dont do it we dont want the zoom thing please
@ConernicusRex
@ConernicusRex 2 жыл бұрын
@@rishilund4120 No. Nobody does. Stop.
@gumstuckinmypocket
@gumstuckinmypocket 2 жыл бұрын
wacky zooming is making me see-sick. ugh
@michaelsanford5233
@michaelsanford5233 3 жыл бұрын
Quickly history lesson: Apple acquired NeXT Computer in 1996 Before Xcode, there was Project Builder and Interface Builder. nib = NeXT Interface Builder. Xcode merged Project Builder and Interface builder into one app and nib file format changes to XML. xib = XML Interface Builder. NSString = NeXT Step String.
@muhammadharoon7928
@muhammadharoon7928 3 жыл бұрын
Hi, The tutorials is very helpful and informative, bu the zoom level is too close and i got lost and difficult to catch the actions. @ios Academy: - Please try to zoom out for easily understandable and follow the procedures.
@harolddavidson5598
@harolddavidson5598 2 жыл бұрын
Agreed. The zoom on this one was a little too much. Hard to pause and copy what was being done if following along.
@mutasemwahbeh6954
@mutasemwahbeh6954 3 жыл бұрын
Thank you Afraz!
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Youre welcome
@saleemabbas4275
@saleemabbas4275 2 жыл бұрын
Great way of explanations
@hasanbasriozturk1550
@hasanbasriozturk1550 3 жыл бұрын
I love how you sum things up in a video shorter than 20 minutes. Keep on doing the good work please
@Ravikanth_007
@Ravikanth_007 4 жыл бұрын
Thanks for the video, very well explained.
@iOSAcademy
@iOSAcademy 4 жыл бұрын
You're very welcome
@yashuttekar1640
@yashuttekar1640 Жыл бұрын
Thanks. Your videos really help me. Can you explain mvvm using an api call ?
@Rafaglg
@Rafaglg 9 ай бұрын
why you compiled first before doing some code? is any reason behind that?
@xchen430
@xchen430 3 жыл бұрын
Should the ViewController still hold a reference to the model array (Person in this example) in MVVM? Also do network calls go in VC or VM?
@hustlas4ever
@hustlas4ever 4 жыл бұрын
Hi! Thank you so much. If you have time please expand this. Like how do we arrange the project structure using MVVM?. Thanks. Am I too demanding? Sorry lol but I really like your pace and how easy to understand your explanations. Thanks again, we really appreciate it.
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Youre welcome! And you aren't demanding at all! I love getting suggestions :) Glad you like to help
@67Diadem
@67Diadem 3 жыл бұрын
Hello, great tutorial. A small request kindly please make video without using storyboards, because many companies does not hire ios developer who use storyboards, programmatically is the best way to learn. May be it's hard to learn to code everything like to create tableview or etc, but companies want those candidates who create an app without using storyboards. If you have complete beginner tutorials that creates an ios app then please shar the link. You are a very good teacher and I want to learn from you...
@markyjordan
@markyjordan Жыл бұрын
Hi! Thank you for the tutorial! I was wondering, how does the viewModel you introduced make the ViewController less massive? Thank you :)
@IraniyaNaynesh007
@IraniyaNaynesh007 4 жыл бұрын
How can we update the model from user action lets say I'm showing some list which has a fav button so when the user clicks on fav in the cell I want to update the model, So what's the best way to update using MVVM,?
@alobaili
@alobaili 4 жыл бұрын
Thanks for the video. Great content! Here's my note: The view controller class had more lines now. I could have left it accessing the model object directly and take what property I want. I didn't get why having a middleware object which is the view model makes the code cleaner. Even if the person object had 100 properties I can still get the 2 I wanted without having to implement a view model object. Because I'm still a beginner in iOS development (only about a year into it), maybe I need to work on more projects to see its value.
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Great question - and actually you're observation is correct. You can in fact use the model directly like MVC but here is why that is not advised. There are cases where one underlying model, maybe like a singleton owned model, could be driving multiple view controllers and views. Let's say a network call updated that model with a certain property and only one view needs to be refreshed. It becomes hard to isolate those view update operations - enter viewModels. For thise case, say we have 12 views powered by data belonging to 1 model - if we only have 1 property update on one viewModel, we know what view it ties to. With large projects at scale, this saves us a ton of complexity and frankly makes smaller (viewModel) objects to work with. Hope that helps :)
@BABEENGINEER
@BABEENGINEER 4 жыл бұрын
In MVVM, don't we try to avoid having any instance of Model in the View/View Controller? Shouldn't it be an instance of Model in the View Model, and an instance of View Model on the View/View Controller?
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Yes, you can do it that way too. There a few different flavors of the pattern
@afaaqahmedsaqi
@afaaqahmedsaqi 3 жыл бұрын
Amazing stuff very well done!, nice and concise video on MVVM. I really got this easily. One feedback is do zoom but just a little bit zoom so we can know where you are. However you are doing great.
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks for the feedback
@hiteshchouhan4026
@hiteshchouhan4026 3 жыл бұрын
Can we use data Model in viewController while accessing data from viewModel in MVVM pattern ?
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Yes
@rondamon4408
@rondamon4408 2 жыл бұрын
Xib is the XML file, the nib is the compiled one, which is the one copied on the application bundle.
@ashwina.u2876
@ashwina.u2876 3 жыл бұрын
good one for a beginner. It would be better if you explain MVVM with Combine or RxSwift. Your explanation is simple and make sense. :)
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks
@ConernicusRex
@ConernicusRex 2 жыл бұрын
RxSwift isn't really used at all anymore since Combine came out.
@camelectric
@camelectric 4 жыл бұрын
Answering your 10 years old question, in ancient OS X days, nibs where native files. In OS X 5, the changed the format to xml, hence Xib.
@deanolium
@deanolium 4 жыл бұрын
And NIB comes from Nextstep Interface Builder, as OSX and the visual builder parts of Xcode are all based on NextStep.
@aparnarvd4343
@aparnarvd4343 2 жыл бұрын
Great tutorial, thank you for sharing the information. Like you said 1. Can we use MVVM for large/bigger projects which are going to use the app in millions? 2. Is this design pattern useful for any specific domain apps? Please advise me on the Pros and Cons.
@krishanmadushanka9521
@krishanmadushanka9521 4 жыл бұрын
Where do we write the business logic in mvvm? In some articles it says Model and in some other articles it says Viewmodel.
@vindajojo
@vindajojo 4 жыл бұрын
Nice video👍(Don't zoom, I can see what you type😄)
@DigitalHole
@DigitalHole 4 жыл бұрын
Super smooth explanation.. Keep up the great work 👍
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Thanks! Much appreciated
@cuevas714
@cuevas714 4 жыл бұрын
Thanks ! So the view-model is pretty much just the entire data that will be held/used by a component along with it's custom functions. In bigger apps would a screen with custom components all be separated into their own view-models ?
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Basically, the main takeaway is that viewModels are not equal to models. If a view only shows a small subset of a model's data, that it what it should be. In large projects, yes, each view has its own viewModel and often, a controller has 10+ core views. This pattern really helps separate out backing data and logically group code organization
@cuevas714
@cuevas714 4 жыл бұрын
iOS Academy thanks ! I was reading a book about design patterns and it mentioned MVVM makes the using of bindings in order for the view-model and view to update one another. It’d be great if you could eventually make a video about these bindings and how companies handle bindings. Thanks again for the goldmine of content :)
@ConernicusRex
@ConernicusRex 2 жыл бұрын
A lot of the problem with MVC comes from people using vanilla MVC on swift projects instead of MVC-A (The apple model). MVC-A and MVC+S are as good as MVVM in non-reactive architectures.
@hareeshgangadhara415
@hareeshgangadhara415 2 жыл бұрын
How to know why we use mvvm over mvc?
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Subjective
@abdullahkidwai7222
@abdullahkidwai7222 4 жыл бұрын
Hello I am getting the following error: Thread 1: Exception: "unable to dequeue a cell with identifier CustomeTableViewCell.cellIdentifier - must register a nib or a class for the identifier or connect a prototype cell in a storyboard" Your help would be appreciated.
@ishaqhamin
@ishaqhamin 4 жыл бұрын
Really struggling to find a good tutorial on MVVM in Swift and I really struggled with yours. The zooming in and out was horrible, you explain well but you go really fast. I was coding along and got a few errors but cannot see enough of the full screen to see where I go wrong.
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Ill do another one, go slower and zoom less. Thanks for the feedback
@ishaqhamin
@ishaqhamin 4 жыл бұрын
iOS Academy no problem. Seems like you’re on the right path, though!
@priktop8440
@priktop8440 3 жыл бұрын
@@iOSAcademy Did you create this one yet? I would be welcoming it :)
@samha1513
@samha1513 Жыл бұрын
Viewmodel should have an instance of the model. VideModel { var model = Model() let firstname:String { Return firstname = self.model.firstname } } Just saying
@talhakhanwhizpool7813
@talhakhanwhizpool7813 4 жыл бұрын
Wrong explanation, where is data binding?
@iOSAcademy
@iOSAcademy 4 жыл бұрын
You don’t necessarily need to use data binding
@MrBrunomalo1
@MrBrunomalo1 3 жыл бұрын
But, yo have to put de datasource in other file, the viewcontroller have to be stupid, only for show data. Your example is so bad.
@AmitBiswastunebox
@AmitBiswastunebox 4 жыл бұрын
Can you create a video on MVP design pattern too ? Please
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Yep! On my list!
@AmitBiswastunebox
@AmitBiswastunebox 4 жыл бұрын
iOS Academy Thanks a lot ! I am so glad you are doing so well . Incredible stuffs with phenomenal passion and effort
@eminemini4500
@eminemini4500 4 жыл бұрын
The video is amazing, but constant zooming in and out looses focus. You have to remove that from your videos!
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Thanks for the feedback
@brilliantaksan
@brilliantaksan 3 жыл бұрын
umm, sorry but is this UIKit? i thought at first this was a swiftui video hahhahah
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Yes, uikit
@ziedagoubi7652
@ziedagoubi7652 Жыл бұрын
this is not an mvm pattern because you missed the most important thing which is the view shouldn't knows about the data it should be dummy as much as possible, so move that data to the viewmodel and create an instance of the viewmodel in the initialiser of the view
@ShahinShamS
@ShahinShamS 4 жыл бұрын
This is no MVVM
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Im going to do a more in depth MVVM video for folks who want more in depth
@semihozsoy982
@semihozsoy982 2 жыл бұрын
I like your videos but this video does not very understandable concept of MVVM. Why I am saying this because MVC to MVVM maybe good way to explain the concept but in my side it just complicate the things which is related the MVVM.
@nodetransit
@nodetransit 2 жыл бұрын
I did not watch it because it was nauseating. Why not record it in a smaller resolution and stop zooming in and out?
@iOSAcademy
@iOSAcademy 2 жыл бұрын
New videos have no zoom
@burakturhan9708
@burakturhan9708 Жыл бұрын
I just would like to say please dont zoom frequently and too much it makes hard to keep in fllow
@iOSAcademy
@iOSAcademy Жыл бұрын
New videos have no zoom. Thanks for the feedback
@yuthegamer1794
@yuthegamer1794 4 жыл бұрын
No offense and thanks for your effort, by the way you communicate, you are a beginner ios dev, and this video demonstrates MVC not mvvm, please stop confusing the new comers.
@30guarino
@30guarino 4 жыл бұрын
He's been at for 10 years....think he has some experience lol
@prahladreddy6839
@prahladreddy6839 3 жыл бұрын
No Zooming, please
@Star-rq3jd
@Star-rq3jd 2 жыл бұрын
no zoom plz.
@ReviewGame10
@ReviewGame10 5 ай бұрын
The zooming part is annoying as ....
@learnwith1807
@learnwith1807 4 жыл бұрын
this is not view model full content!!!
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Ill be doing a follow up. Itd be great if you mention what more youd like to see
@JavierWarren-q8d
@JavierWarren-q8d 2 ай бұрын
Thompson Margaret White Anthony Johnson Daniel
@MrReneArguelles
@MrReneArguelles 4 жыл бұрын
The zooming in and out is just unbearable :(
@iOSAcademy
@iOSAcademy 4 жыл бұрын
Newer videos dont have zooming. Im going to redo this video!
@apintex
@apintex 3 жыл бұрын
horrible with so much zoom
@iOSAcademy
@iOSAcademy 3 жыл бұрын
New videos have no zoom :)
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 115 МЛН
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 47 МЛН
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37
Swift: How to Migrate MVC to MVVM & Intro Unit Testing
33:11
Lets Build That App
Рет қаралды 116 М.
Проект на MVVM в Swift
17:32
ИЗИ DEV
Рет қаралды 5 М.
MVP по SOLID c DI и Unit test на Swift 5 part 1
54:47
The Swift Developers
Рет қаралды 31 М.
ModelViewViewModel (MVVM) на Swift, iOS простой пример
29:29
iOS на практике
Рет қаралды 15 М.
MVVM Architecture in iOS (Swift)
34:25
Venu Gopal Tewari
Рет қаралды 6 М.
Understanding MVVM Design Pattern
10:47
azamsharp
Рет қаралды 42 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 115 МЛН