iOS MVVM swift code review best practices | Hindi
HTML-код
- Опубликовано: 1 авг 2024
- MVVM (model view view model) is an architecture pattern that's catching up in the iOS domain and hence it's important to know how to write clean code with iOS.
We had a small event on the iOS cafe discord server to review a sample code using MVVM pattern and discuss what are the best practices to follow using MVVM pattern in Swift.
Hope this video helps to write clean and stable code.
Given are the chapters for the video
0:00 reviewing constant file
0:50 reviewing validation layer
4:42 avoid writing negative logic
5:44 reviewing the HttpUtility
13:03 reviewing the model layer
15:40 reviewing employee resource
17:02 reviewing test cases
17:40 reviewing login resource
19:03 reviewing login view model
22:11 dependency inversion
23:55 swift lint
24:46 reviewing the view controller
27:10 conclusion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
✅ Subscribe to the channel and stay ahead of everyone by following the right way for writing clean code in swift. 🔥🔥🔥🔥🔥
🔗Click on the link to subscribe: ruclips.net/user/codecat?sub...
iOS Cafe discord server invitation link: / discord
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------------------------------------------------------
############################################
Connect with me on social media
Instagram: codecat15
📧: codecat15@gmail.com
🐦: / codecat15
Facebook: / code.cat.792
Github: github.com/codecat15
###########################################
#swiftmvvm #MVVM #modelViewViewModel
This video is really helpful in understanding the mvvm and code writing styles
Glad it was helpful 😊
Following your channel after a simple search of multithreading in swift and watched almost every videos now.
Learning both Hindi and Swift :)
Thank you Vishnu, I try to add English captions on few of my videos but then adding captions is really time consuming but still if you get stuck don’t hesitate to ask questions I’ll be happy to answer it for you.
@@CodeCat15 No problems . I got a lots of my doubts cleared from your old videos even without captions 🙂🙂
That’s great
Great review
Thank you Pratap
Hum first, hum first
This is very informative video
Though I am not iOS Developer, I like to watch your videos...
Wonderful
Thanks Shubham, means a lot 😊
Great, and very helpful, Ravi, where is source code of it?
Why not using weak self in closures? Can you please explain
I wish you a vert Happy Birthday ravi sir
Thank you Akshay 😊
This is valuable content, and I wish it could be in English.
Thank you for your suggestion. I appreciate your interest in English content. As my current audience prefers Hindi, I'll continue creating content in Hindi to cater to their needs. However, I'll consider adding English subtitles in the future to reach a wider audience. Thank you for your support!
Ravi you are very helpful person and also shared expensive industry experience free of cost , I need your suggestion on this -> I want to prepare DSA and system design for amazon interview can you guide me from where I need to start ,
Get the book how to crack coding interview it’s a decent book that should help you out, although it’s not guaranteed that whatever question you read online or solve that’s the one that Amazon will ask but the book and sites like leetcode are a big help in preparations to give you that head start
@@CodeCat15 big thanks Ravi sir
Hahaha har jagah code 200
the clarification they give is code 200 is request went through abi tum status check karo true aur false ka.
Yes faila huwa business hai bhau,
Bro already 10k subs. Soon we will celebrate 100k
faila hua business to hai creative developers ka, but If I can become a responsible developer from being a creative one I am sure they too can. Thank you Sanjay
discord server link is not working
I verified the link and it takes me to the accept invite page, you have to accept the invite and then it’ll take you to login/signup screen.
Once that happens you would then need to verify yourself by adding a captch in verify-here channel and then you would have the access.
May I know what you are seeing when you click the link?
make a vedio on api with almofire
for simply parsing API I advice not using a third party tool as it adds no value to the project, is there a different use case you have in mind for using alamofire?
@@CodeCat15i want to use for api integration i am at beginer level,kindly make a vedio in detail
If it’s simple API parsing then I suggest looking at the API playlist which uses URLSession as that has been the industry standard, many devs are moving away from alamofire or any third party library to do API parsing or even SSL pinning and they use URLSession.
If you are a fresher then I strongly advice against using alamofire and perform parsing using URLSession
19:30 - A reference cycle only occurs if both types involved are reference types, not if one is a value type. Therefore, conforming to AnyObject is unnecessary when one side is a struct.
The reason a ViewModel (VM) should be a class rather than a struct is due to state management. When a property of a struct is changed, the entire struct is recreated with the new value, causing the rest of the state to be lost. This means we would need to retain the shared instance every time the value of the struct-based VM is changed, which is not practical.
Please correct me if I'm wrong, @codecat15 @ravi.
right, but then as I explained in the video that mostly devs prefer class over struct and the explanation was given to ensure that if the view-model (VM) is a class then ensure the AnyObject conformation and the implementation of weak.
A VM should never hold state whatsoever it is an orchestration class and not a class that manages state of the objects.