Let's create a modern syntax for Dependency Injection in Swift (ft. Antoine v.d. Lee)

preview_player
Показать описание
#iOS #swift #softwaredeveloper #iosdeveloper

Thank you for watching this video 🙌

(affiliate link)

LINKS

Рекомендации по теме
Комментарии
Автор

Did you find this syntax useful? Are you planning on using it in your apps? Let us know in the comments 🚀

v_pradeilles
Автор

L40, L52 needed "nonisolated(unsafe)" in Swift 6.

hackenbacker
Автор

Super cool! Love the modern, SwiftUI like approach here. It feels so natural for the language.

rickywitherspoon
Автор

A question that came into my mind. Is how would you handle dependencies that themselves require other injectables with this approach?

souhailmarghabi
Автор

Really cool idea! I have a question what if there are to components injects into same property then will it not become data race? like view1 needs NetworkProvider(url1), view2 needs NetworkProvider(url2)?

pavankumar.m
Автор

Very interesting approach. However, I had this problem implementing your solution. I have this Dependency (a repository) is used 2 different views. I want to inject a computed dependency that creates a new instance everytime. I can't do it with this approach since everyhing is a static var value type here

tylerlu
Автор

Really Really nice!, just one comment, we can avoid the type of the var in the @Injected property wrapper because can be inferered like @Environmet var, less code :P

finalpets
Автор

This is clever and modern. Unfortunately I couldn't use this approach in my project where dependencies are often reference-types objects, which themselves can have other dependencies...

tiam