Swift: VIPER Design Pattern (Architecture, 2023, Xcode 14, Swift 5) - iOS Development

preview_player
Показать описание
In this video we will learn about the VIPER design/architecture pattern for Swift 5 and iOS. This is a common pattern for large apps to properly isolate objects and their responsibility.

#swift #designpattern #ios

** Like my teaching style? Check out some of my most popular courses!

Join this channel to get access to perks, code, groups, and more:

** Get Skillshare free for 2 Months and learn iOS

** Manage all your investments from app earnings on Betterment!

** Grow your own Youtube tech channel with TubeBuddy:
Рекомендации по теме
Комментарии
Автор

Thanks for creating this video! It's pretty easy to understand. But I would like to point out that in your code, there are a few retain cycles with view, presenter, router and interactor. One option you can do is to make those protocols conforms to AnyObject, and mark these references as "weak":
1. router's ref to presenter
2. router's ref to view
3. presenter's ref to view
4. interactor's ref to presenter

Eventually your object relationship will look like this in the memory, where -> means a strong reference

router
^
|
window -> View Controller -> Presenter -> Interactor

Correct me if I'm wrong.

xiaoyuguo
Автор

I started a new job and they use VIPER. I'd never used it before and I struggled to get through some explanations of VIPER (ADHD).
This explanation was so concise and easy to understand. Thank you so much, man! ❤

keenancookson
Автор

Great video! You really explained it well, thank you!

coolcodingdad
Автор

A great intro to VIPER. Actually, go ahead and watch it!

AndGordy
Автор

They all connect by strong reference between each other? Where are the weak references?

Charlot
Автор

Couldn't manage to *destroy* that like button. It still works.

BHFJohnny
Автор

I have been trying to learn this from a long time. Finally i found this hands on tutorial instead of those redundant concepts articles. Thank you

Bhaukaal-YT-
Автор

Whenever I search for Swift/ iOS, I ended up with this channel :)
I'll just search in this channel first next time lol

tcleedev
Автор

And finally i understood the VIPER, thanks a lot man

sandipkhedkar
Автор

I was trying to learn VIPER but seems confusing, this video is so simple and easy to understand.

abhishekthapliyal
Автор

Hi do you have git for this? It would be better if also inspect on code to learn better

burakturhan
Автор

What I do is that presenter will have reference to View, Interactor and router but only the View will have reference to the presenter. Interactor and Router does not need to have a reference of the Presenter. With using async and await the presenter will wait for interactor to do the network calls and return the data. Its also a good practice to have a separate helper class for the network calls instead of writing them completely in the interactor.

abdullahumer
Автор

it would be nice if you extend this tutorial for navigation on multiple screens, delegates, callbacks and how to handle this in VIPER appropriate. And yeah, thanks for video. Cleanest explanation of VIPER ever I see 👍

sashamakedonskii
Автор

why does the interactor had to have a reference to presenter? doesn't it better if the interactor just return a result? hence it did not know anything about the caller = less coupled

bonioctavianus
Автор

Viper is a little bit confusing, but we can isolate the modules, functionalities, I think it was easier to test. Thank you so much for the great lesson! (:

FilipeMarques
Автор

THANK U SO MUCH!!! 
IT REALY USEFUL!!! 
FROM RUSSIA WITH LOVE ❤️❤️❤️

mishar
Автор

Great content👍, I love when u start project without storyboard. VIPER is one of the design pattern that I want master but always fail. Hope with this tutorial I’ll get proper understanding.

nurlanakylbekov
Автор

Thanks for the tutorial. I have question about the code written to create table, label etc. It is a function right, doesnt it get called everytime table or label is accessed and keeps creating new instance of table or label?

nashtravelandlifestyle
Автор

Good video explaining basics. I would like to see some more informations about coordination between modules. I use approach of adding Coordinator pattern into VIPER. Also, Router should be responsible only for routing not building a module - here is good to use some Module builder by using fabric pattern. This way we use SOLID principles. There is also questionable for me conforming to UITableViewDelegate and UITableViewDataSource in UIViewController component. What do you think about using Presenter to conform to that protocol - then we keep responsibility of proper presentation on the side of Presenter (view shouldn't convert DTO to ViewModel). I am also curious about automation for it. I created Xcode template which creates entire module with 1-click, but I am still researching for making it better - that's why I am looking for more opinions :) . Thank you for your work and I am waiting for part 2 with advanced part.

lukasz.szarkowicz
Автор

I’m don’t really like VIPER. To much classes. Most of classes knowing about other ones. View layer contacts with models. My preference to Data Driven MVVM + Coordinator (for routing) + Builder (factory to create units) + proxy pattern for fetching data from web or storage. Any way it’s a great video to understand this pattern. Thank you!

barche