How to use Dependency Injection in SwiftUI | Advanced Learning #16

How to use Dependency Injection in SwiftUI | Advanced Learning #16

Swiftful Thinking

2 года назад

26,528 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@spradohak
@spradohak - 30.12.2023 13:46

Brilliant, I had to watch it multiple times but now it make more sense.
Thank you Nick

Ответить
@gfmolon
@gfmolon - 28.10.2023 20:48

Nice.

Ответить
@josemanuelortizsanchez4983
@josemanuelortizsanchez4983 - 23.08.2023 19:44

Thanks Nick, good resume!

Ответить
@BSharing09
@BSharing09 - 16.05.2023 11:41

Excellence tutorials, you are the best teacher.

Ответить
@michaelsamoylov
@michaelsamoylov - 20.04.2023 16:38

Thanks for sharing this. I'm a big fan on Uncle Bob and Clean Architecture. It appears to be working well with one view but how would you make it work with several views sharing the same data service?

For example, adding a record in one view and getting it in another view.

Using `PassthroughSubject` from Combine and adding a data publisher looks like huge added complexity IMO.

Ответить
@woozoobro
@woozoobro - 05.04.2023 15:49

You are truly amazing!!!! Now I understand your crypto app code!!!

Ответить
@bonifacy9511
@bonifacy9511 - 30.03.2023 10:40

@Swiftful Thinking, how about passing VM's through .environmentObject? Or can you show how to initialize VM's on the top and pass it to he n child view? eg with this Dependencies class?
We need a better explanation of that

Ответить
@mylaluna
@mylaluna - 19.03.2023 17:39

Hi man, your videos have been very helpful to me.

Ответить
@zawysa
@zawysa - 16.03.2023 13:14

In general good work. Though you forget to mention that dependency injection can be very difficult to keep track of in big projects. Keeping track of all the dependencies is like visually having to keep track of a big DAG in your head. Do you know good DI container frameworks?

Ответить
@yourgflikesit
@yourgflikesit - 07.03.2023 16:00

I’m absolutely confused as to why you would do this over @EnvironmentObject

Ответить
@arkemal
@arkemal - 21.02.2023 19:45

Man, this is an excellent course. Thank you!
Do you have other video related to SOLID principales?

Ответить
@douglasrutledge1325
@douglasrutledge1325 - 08.01.2023 22:07

I broke thru the 'DataService' barrier; ... how many times can you say 'DataService' before a programmer passes out? hahaha. I watched until the end but still no further ahead. So do I get the point? NO ; I'll watch it again, again an again

Ответить
@douglasrutledge1325
@douglasrutledge1325 - 07.01.2023 17:37

...stressed you guys out... too late!

Ответить
@douglasrutledge1325
@douglasrutledge1325 - 07.01.2023 17:30

I skipped this video, too deep! but I'll try it now... I'll let you know... anyone have a shovel?

Ответить
@AdjieSatryo
@AdjieSatryo - 16.12.2022 12:57

So easy to understand explanation. But the main reason im using singeleton is to using it from any class (ie. Network Manager, Socket Manager, Coredata manager). So, how can i share dataService class to other class? Thank you

Ответить
@aspublic
@aspublic - 27.11.2022 20:12

Very useful video, but it would be great to have another video explaing dependency injection works with Core Data and a navigation of sub-views

Ответить
@tbg6nb
@tbg6nb - 27.10.2022 10:17

Shouldn't a singleton have a private init ? Otherwise you can create multiple instances

Ответить
@merlingrim2843
@merlingrim2843 - 05.10.2022 13:14

So even though you inject the dependency, the injected value/class instance is still effectively subject to threading issues.

Ответить
@stevexphotography128
@stevexphotography128 - 14.08.2022 00:37

Hi Nick! Thank you for your awesome tutorial! I'm wondering that what if I want to create more DataServices for other Models, say UserDataService for Users, CommentDataService for Comments, etc. There might be different parameters for the same func name `getData()` or `addData()` or something else in different DataServices. I've tried to add the same func name with no parameters in DataServiceProtocol but got errors, swift think they are different functions. So how should I arrange my DataServiceProtocol or should I still use protocol? I'm still a beginner and I would really appreciate it if you could offer some suggestions.(Maybe I should move this comment to the protocol tutorial...😂)

Ответить
@user-yd9xy3rb4x
@user-yd9xy3rb4x - 06.07.2022 16:19

What a minute how to inject a view model to a view, that's why I started watching the whole video. Good stuff BTW.

Ответить
@user-eg7ep8db8j
@user-eg7ep8db8j - 12.06.2022 16:41

It's great video!!! amazing~~~
thank you for sharing this topic!!

Ответить
@lincolndickerson1293
@lincolndickerson1293 - 23.05.2022 15:05

Great video again! One question and this may take another boot camp to answer, lol. I see core data as a data service. It is common practice to use @Environment to hold the context of the core data entity. It is then easy to swap contexts for previews, testing… Could we and should we put our DataService master class, the one that holds many data services, into the Environment and use it in the same way? Like core data we would inject into the View init fetching criteria.

Ответить
@TheSpiralnotizblock
@TheSpiralnotizblock - 22.05.2022 22:27

What we would do if we have a mock class that conforms to a DataService protocol, but the mock class doesn't need all of these methods of the protocol? For example it needs only 2 of 5

Ответить
@amirpirzad2750
@amirpirzad2750 - 08.05.2022 01:27

So awesome 👏🏾🌹

Ответить
@mhmtkrnlk
@mhmtkrnlk - 22.04.2022 17:22

MVVM architecture is realy feast to eyes. After UIKit

Ответить
@jimmyhuang1114
@jimmyhuang1114 - 22.04.2022 09:02

Wonderful tutorial about dependency injection. Thanks you for your efforts and clear demonstrations. :)

Ответить
@TheMadG007
@TheMadG007 - 05.04.2022 21:08

Thank you very much, the entire last week I tried to learn how to replace my singleton Storageprovider (for Core Data) in an appropriate way with dependency injection for easier testing .... I struggled especially regarding initialization of the ViewModel (as StateObject)... everything I needed to know was in this video! 👍

Ответить
@candylover2456
@candylover2456 - 23.03.2022 06:15

Amazing! You never fail to teach a hard concept and make it easy. Thank you so much, you make a huge impact with your work :)

Ответить
@vebbis5961
@vebbis5961 - 22.03.2022 17:16

How would you use dependency injection if you also had another service communicating with the service that communicates directly with the viewModel? Example:

UserViewModel -> UserService -> StorageService/UserRepsoitory

Ответить
@dispatchswift
@dispatchswift - 22.03.2022 13:07

Superb explanations.

Ответить
@joe0212
@joe0212 - 05.03.2022 06:24

Should the view not be passed the view model as dependency

Ответить
@xpopcornx1747
@xpopcornx1747 - 23.01.2022 07:38

He skipped the most important part which is where and how to create the dependencies...

Ответить
@aybarsacar9375
@aybarsacar9375 - 19.01.2022 09:46

Hi Nick, great content! -- it would be great to see an app from you with Clean Architecture from Uncle Bob using SwiftUI - it would be great to see the ways we can create dependency injection containers to manage them in our apps. Looking forwards to your new content

Ответить
@fsdolphin
@fsdolphin - 07.01.2022 05:23

You're simply the best!

Ответить
@allisondelta1
@allisondelta1 - 19.12.2021 03:23

Blown Away ! Your tutorials are so rich with information. I have adapted my own logic based on your practices. Very succinct ! TY !

Ответить
@jarodpaulson9439
@jarodpaulson9439 - 14.12.2021 21:37

Great video man.

Ответить
@mhfs61
@mhfs61 - 09.12.2021 01:29

👍🏼👍🏼👍🏼

Ответить
@ufukk54
@ufukk54 - 02.11.2021 20:56

Hi sir. How do I transfer data between pages with Dependency Injection? Can you make an app with 2 or 3 pages about it?

Ответить
@samisanoof
@samisanoof - 25.10.2021 11:50

I found your way of explaining things the best of all. Do you have any plans to make similar videos on Combine Framework?

Ответить
@thahiraf1317
@thahiraf1317 - 24.10.2021 13:37

I am following your videos, xcode 13 making too much problem. what is the solution?

Ответить
@TechnoBog-ov2mp
@TechnoBog-ov2mp - 23.10.2021 23:02

I found this channel as the best for iOS developers

Ответить
@egorsev
@egorsev - 23.10.2021 10:41

Could you do video lessons about the Combine?

Ответить
@happyuser109
@happyuser109 - 23.10.2021 09:57

Really great video!

Ответить
@kerryferguson8267
@kerryferguson8267 - 23.10.2021 02:32

Unrelated to the topic but I'm also learning great explanation skills and methods by watching your videos. I'm gonna steal it for my interviews lol.

Ответить
@bbongrip
@bbongrip - 22.10.2021 22:21

So awesome! I really appreciate the way you explain things. Been looking for a while for videos that go in depth and really explain things instead of just showing one example. Keep up the good work!

Ответить
@priceringo1756
@priceringo1756 - 22.10.2021 22:20

Great post! About two thirds through the video I am on the edge of my seat thinking what about testing? Please don't wait to talk about that. You came through in the clutch. I realize you are going to expand on that in the future. Don't change a thing.

Ответить
@princeabyss4976
@princeabyss4976 - 22.10.2021 17:41

nice DI video, thankss 😁

Ответить