Model view controller MVC design pattern in Swift iOS (Hindi tutorial)

Поділитися
Вставка
  • Опубліковано 2 сер 2024
  • Model view controller or MVC is the default design pattern of iOS apps, MVC in swift programming can be implemented using the various features mentioned in the Apple developer documentation. But just implementing MVC design pattern ios swift is not enough one must also follow good programming principles to make sure that they have less coupling in their code.
    This MVC in swift hindi tutorial with easy examples helps beginners to understand this design pattern and implement it using the right techniques in their project. The model view controller example in this video will guide you in making the right set of decisions while implementing this pattern.
    Model view controller swift is an excellent pattern for your project but it depends on how you implement to avoid massive view controllers.
    In this MVC swift Hindi tutorial I will be explaining the core concepts of MVC along with how you should not implement MVC and on that note let's have a look at the categories that we will cover today
    0:00 Introduction about the video
    0:42 Summary about today's topic
    1:54 Model View Controller explained
    2:02 Why implement a design pattern
    2:39 History of MVC
    3:20 Model in swift MVC and its responsibilities
    5:57 View in swift MVC and it's responsibilities
    7:04 Controller in swift MVC and its responsibilities
    8:41 Incorrect implementation of MVC iOS app code review
    13:04 Does MVC cause a massive view controller?
    14:46 Dividing responsibilities across layers
    17:25 My opinion on MVC
    Apple MVC documentation: developer.apple.com/library/a...
    Apple View Container documentation: developer.apple.com/library/a...
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ✅ 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: ua-cam.com/users/codecat?sub...
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    -----------------------------------------------------------------------------------------------------------------------
    📥 Download the source code from
    Github: github.com/codecat15/UA-cam-...
    Google Drive: drive.google.com/file/d/1HB2B...
    -----------------------------------------------------------------------------------------------------------------------
    🎶 Royalty-free Music: www.bensound.com
    ############################################
    Connect with me on social media
    Instagram: / codecat15
    📧: codecat15@gmail.com
    🐦: / codecat15
    Facebook: / code.cat.792
    Github: github.com/codecat15
    ###########################################
    #mvcSwiftExample #mvcInSwiftInHindi #mvcSwiftBeginners

КОМЕНТАРІ • 78

  • @U-and-Mee
    @U-and-Mee Місяць тому +1

    Next Level Video, Thanks.

  • @ernishant11
    @ernishant11 3 роки тому

    I really appreciate the way you explain things. Thank you so much!!

  • @rishilund4120
    @rishilund4120 2 роки тому +1

    Perfect bhai cant thanks much for this

    • @CodeCat15
      @CodeCat15  2 роки тому

      Happy this video was helpful Rishi 👍

  • @akhilgupta6883
    @akhilgupta6883 2 роки тому +1

    Very clean and simplest explanation I have ever seen. Thanks a lot Code Cat.

    • @CodeCat15
      @CodeCat15  2 роки тому

      Glad you liked it 😊

  • @kapilgoyal7808
    @kapilgoyal7808 7 місяців тому +1

    Very Informative and clean understanding, I have ever seen.👍

    • @CodeCat15
      @CodeCat15  7 місяців тому

      Feel free to ask questions on the topic and do share the content with your iOS group. I hope this channel provides more insights and details for every topic that you search.

  • @rishilund4120
    @rishilund4120 2 роки тому

    are bhai kya mast banate ho videos zbardat

  • @prataprana2963
    @prataprana2963 2 роки тому

    👍🏼👍🏼👏🏻👏🏻Great Video

  • @iamwaseem99
    @iamwaseem99 3 роки тому +2

    Great explanation as always ✌️.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thanks waseem am glad this was helpful, do ask questions on this and feel free to share it with your iOS group

  • @vyankateshshivnikar7932
    @vyankateshshivnikar7932 Рік тому +1

    Very nice explaination....Thanks Ravi...

  • @hardipgajera2316
    @hardipgajera2316 3 роки тому +3

    very informative and waiting for the next session. 👌

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thanks Hardip am glad this video was helpful do feel free to ask questions on this and share it with your iOS group on WhatsApp or Facebook

  • @bishalram481
    @bishalram481 3 роки тому +1

    Thanks for your excellent explanation

    • @CodeCat15
      @CodeCat15  3 роки тому

      Welcome to the channel Bishal, I am glad this video was helpful do watch the second part of this video which is decomposition with MVC, I am sure you will get more insights in that video as well. Do share the video with your iOS group on whatsapp or facebook and feel free to ask questions

  • @GaneshPatil-qu3be
    @GaneshPatil-qu3be 3 роки тому +1

    Apart from explaining things in such a detail 👌..
    You always introduced us with some new terms and concepts. 🤘✌

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I am glad this video helped, and the concepts were already there from day 1 and it's quite sad that nobody reads the documentation where apple has mentioned a ton of good practice to improve our code
      Part of the problem is we just jump to code rather than doing system design or how your code flow will be if we all start doing that the code quality and the productivity of the team will drastically increase.
      Please do share this video with your friends and help them to learn MVC using the right techniques and as always feel free to ask questions :)

  • @twinsbaby5774
    @twinsbaby5774 2 роки тому

    very good

  • @pratikgajbhiye5354
    @pratikgajbhiye5354 3 роки тому +1

    Thank you so much for this video

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I am glad this was helpful pratik do feel free to share this video with your iOS group and do feel free to ask questions on this topic

  • @jabraham08
    @jabraham08 3 роки тому +1

    thanks. finally, it is making sense.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Do checkout the second part of the video which is decomposition in mvc to see how you can arrange your code and make it less tightly coupled

  • @akashrevanna5327
    @akashrevanna5327 3 роки тому

    Thank you for sharing knowledge 🤝

    • @CodeCat15
      @CodeCat15  2 роки тому

      I am glad it was helpful Akash

  • @rohandhankani3962
    @rohandhankani3962 3 роки тому +1

    Than you ravi. I appreciate the effort

    • @CodeCat15
      @CodeCat15  3 роки тому

      I am glad these videos are helpful

  • @saif287
    @saif287 3 роки тому +1

    Totally agree with your point Ravi. I am working on iOS for more than 10 years . MVC is not bad, the way we write code makes it bad. And lastly we start complaining MVC is massive view controller. Love the way u explains things

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      One more thing that I wanted to add to this video was how some creative devs just to try new patterns defame an old pattern and I think that's not a good approach. We should know in detail about the patterns, what problem they solve, how to implement them in their respective technology with good software engineering principles, else it would be the classic case of removing a screw by using a hammer, a hammer is used for a different case to remove a screw we need a screwdriver. I am glad this video was helpful to you Saif, please do share this with your iOS group

    • @saif287
      @saif287 3 роки тому +1

      @@CodeCat15 totally agree. Surely I will share it .

  • @RohitSharma-ps1dx
    @RohitSharma-ps1dx 3 роки тому +1

    very good explanation

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thanks Rohit, please do feel free to ask questions and do share it with your iOS group on WhatsApp or Facebook

  • @akhilgupta6883
    @akhilgupta6883 2 роки тому +1

    Do you have any video on VIP or VIPER ? If Not can you make it, though I have gone trough several tutorials but missing your simple/clean explanation.

  • @shahbazkhan-pb3un
    @shahbazkhan-pb3un 3 роки тому +1

    Nice
    This is show your hard work

  • @aniltodakar6449
    @aniltodakar6449 3 роки тому +1

    A very nice, experienced person can also take help from this.

    • @CodeCat15
      @CodeCat15  3 роки тому

      I am glad the video was helpful Anil, welcome to the channel

  • @suhaspathak6319
    @suhaspathak6319 3 роки тому

    Nice explanation , Is there any disadvantage for MVC?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I don’t really think so, if a dev is facing issues like massive view controller or anything else its probably because they have not structured their code well or followed any design patterns.

  • @bhabanishankarbehera8476
    @bhabanishankarbehera8476 3 роки тому +1

    it was good, and i can't wait for next part of it. so can you tell me when will it come?

    • @CodeCat15
      @CodeCat15  3 роки тому

      Hey there, welcome to the channel am glad this video was helpful to you. I will try to release the second part by Sunday or max by Monday next week. Until then plz do feel free to ask questions on this topic and do share it with your iOS group on WhatsApp or Facebook 👍

    • @bhabanishankarbehera8476
      @bhabanishankarbehera8476 3 роки тому +1

      Ok thanks, 👍

  • @RohitSharma-ps1dx
    @RohitSharma-ps1dx 3 роки тому +1

    Could you please make a video regarding MVVM also.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Hello Rohit welcome to the channel, i did make 3 videos on mvvm and here’s the playlist for the same
      Playlist mvvm: ua-cam.com/play/PLb5R4QC2DtFs8CsVZztGSJ0TM8J2URfg7.html

  • @pratikgajbhiye5354
    @pratikgajbhiye5354 3 роки тому +1

    Which is the best way to create view, xib or programmatically

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I think it depends, you can use storyboard and xibs for uikit based project.
      For larger projects i would never recommend storyboard coz for larger projects they give rise to a different problem, but if you look at swift ui i think apple wants us to use code for creating ui.

  • @sahutarun50
    @sahutarun50 3 роки тому +1

    Second part kb aayega? Excited for that. ✌️

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      mostly next week, next week to clean code pe hoga but what's really interesting is the container and child view controller concept coz using those two concept the UI code can be managed more effectively, Apple's documentation is very detailed on that concept I did share the link in the video description for the same

    • @sahutarun50
      @sahutarun50 3 роки тому +1

      Yes i want to know that. I have Idea of mvc and mvvm but this basic logics are must have to know.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Yup, i think i did see latest and old video and blog tutorials and they do not explain model controllers and container views its only when you know about these two terms you can search them, i wanted to make sure i atleast introduced them in this video so that i can remember to make videos on them later

  • @dheerajgupta5830
    @dheerajgupta5830 2 роки тому +1

    One quick question, as you said in the video that we need separate layer for Business logic, Validations and api calls which is valid but how do you convince this to the interviewer because as per MVC, business logic is a part of Model.
    Please clarify and support your explaination with apple point of view.

    • @CodeCat15
      @CodeCat15  2 роки тому +2

      What happens when you want to share the same business logic with 10 models?
      What will be your approach if you keep BL (business logic) inside models?
      You will end up copy pasting the same code in all those layers breaking DRY principle and this is bad
      Not only that, the code is now tightly coupled to all those models and we have zero reusability.
      Your business logic is now scattered across the entire application than being centralized
      Imagine what happens when the BL needs to change? What then?
      A new developer can easily mess things up if they forget to make change to all those 10 models same goes for the dev who worked in the project
      I agree to most of what apple mentions in their docs but then I disagree that BL should be inside models and the above is my technical reason for the same.

    • @dheerajgupta5830
      @dheerajgupta5830 2 роки тому

      @@CodeCat15 Thank you so much for quick reply and also for the descriptive explanation. Also, putting your reviews/opinion in the end of the video helps, you don't only read the said things, you also optimize by including the last part.

  • @poojanegi9786
    @poojanegi9786 4 місяці тому +1

    I am at 14:09 and if i see image and my room, both are same.

  • @markme7092
    @markme7092 3 роки тому +1

    Waiting for SwiftUI content? I think you should make 3 to 5 video in a week.

    • @CodeCat15
      @CodeCat15  3 роки тому +3

      Man i only wish that was the case coz i love to do that but i am not a full time youtuber and i get time only on weekend to make videos due to work but i been working and learning swift ui and must say its really amazing

  • @Deepakkumar-bi8hf
    @Deepakkumar-bi8hf 2 роки тому +1

    i am having one doubt how it is different from MVVM . mvc me controller and mvvm me view model both are handling same thing suppose i have a validation which i can create diff file for validating and other logic related things in separate file i can call from controller or view model then how is it different not able to understand what is the difference ..BTW nice video i liked your explanation

    • @CodeCat15
      @CodeCat15  2 роки тому

      controller should have one responsibility which is to request data for its UI components and that's all anything you add extra in the controller is a complete violation of its responsibility. Apple has its own flavor of MVC to tackle few things as you may have seen in the video but then too everyone just dumps everything inside the controller and then blames how troublesome MVC is, and if you think MVVM is awesome well now whatever creative devs dumped inside the controller making it massive now the same dumping is happening in view model, so it all boils down to understanding the responsibility of those layers and implementing them accordingly.

    • @deeprajchowrasia6090
      @deeprajchowrasia6090 6 місяців тому

      bro but what should be the appropriate answer for the difference between MVC and MVVM, specifically with respect to ios development@@CodeCat15

    • @pravinnashte9514
      @pravinnashte9514 2 місяці тому

      @CodeCat15 waiting for your reply here for answer for the difference between MVC and MVVM, specifically with respect to ios development, please reply

  • @U-and-Mee
    @U-and-Mee Місяць тому

  • @MrVirani123
    @MrVirani123 3 роки тому +1

    Hello Ravi
    Suppose, in my project uses 40-50 apis. then i create 40-50 resource file. is this oky?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Hey Bhavesh thanks for asking this. The answer is NO. Out of those apis there will be few which belong to the same entity like for example
      1. Get employee
      2. Update employee
      3. Delete employee
      4. GetEmployeeWithDepartmentId
      so these are 4 separate APIs but they belong to the same entity which is Employee so you create a single resource file for them with the name EmployeeResource and add these 4 Apis there same goes for any other entity.
      Let me know if that answers your question and if not plz feel free to ask more

    • @MrVirani123
      @MrVirani123 3 роки тому

      @@CodeCat15 Thanks Ravi

    • @MrVirani123
      @MrVirani123 3 роки тому

      Hello Ravi,
      I understand this but if more entity in project and so i create more file that is any disadvantage.
      My question is separate class has separate file.

    • @CodeCat15
      @CodeCat15  3 роки тому

      So is your concern creating more class in your project? Or creating more swift files?

    • @MrVirani123
      @MrVirani123 3 роки тому

      @@CodeCat15 its nearly 100 entity. so create 100 separate file for each class. It is oky?
      I was google but some person say it good to decompation and some says not to longer good.

  • @dheerajgupta5830
    @dheerajgupta5830 2 роки тому +2

    Sorry to bug you again, but can you please share a git project or a video to show how mvc following project with hierarchy should look like? Its fine, even if the files and folders are empty but hierarchy is what i need to know.

    • @CodeCat15
      @CodeCat15  2 роки тому

      Let’s do this, add in your understanding of this hierarchy and I’ll add corrections to it if needed.

  • @avii___7
    @avii___7 7 місяців тому +1

    Isn't MVC is architectural pattern instead of design pattern ?

    • @CodeCat15
      @CodeCat15  7 місяців тому +1

      Apple calls it a design pattern for some reason so I went with that. However it’s an architecture pattern coz it deals with organizing the folder structure.

    • @avii___7
      @avii___7 7 місяців тому +1

      OK. Btw, thanks for giving us free education.

    • @CodeCat15
      @CodeCat15  7 місяців тому

      @avii___7 Welcome 😊