Using Closures as Dependencies

  Рет қаралды 1,109

donny wals

donny wals

Күн бұрын

In this video we'll explore an alternative way of injecting functionality into your objects. You'll see how you can use closures to inject only the functionality you really need rather than an entire object which makes scoping your dependencies much easier, as well as improving composability and testability of your code.
This video is a companion video for the following blog post: www.donnywals.com/using-closu...
Check out my Swift Concurrency course right here: donnyplus.com/p/practical-swi...

Пікірлер: 6
@jyotinkarpandey
@jyotinkarpandey 3 ай бұрын
Can we have a sample project link ?
@DonnyWalsdev
@DonnyWalsdev 2 ай бұрын
Hey! So sorry, I don't have a (publicly available) sample project available for this.
@victorriurean
@victorriurean 3 ай бұрын
@weeee733
@weeee733 3 ай бұрын
Thanks for the tip! Also these closures make use of withContinuation methods)
@loganblevins8633
@loganblevins8633 3 ай бұрын
Nice video! Why not make a smaller protocol only giving the needed capability and then make the other protocol conform to the smaller if needed?
@DonnyWalsdev
@DonnyWalsdev 3 ай бұрын
You'd end up with loads of small protocols that are composed into larger ones when needed. This can certainly help with scoping and mocking, but at the same time having so many protocols can be quite unwieldy; especially when an object needs to have a composition of parts of protocols and you end up having to break things down even further. Of course, it might make more sense for some codebases then others. This is just one tool in your toolbelt for injecting and composing dependencies
Key Gradle Concepts And Practices - Kenneth Kousen
1:03:10
Developer Summit
Рет қаралды 1,2 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 42 М.
THE POLICE TAKES ME! feat @PANDAGIRLOFFICIAL #shorts
00:31
PANDA BOI
Рет қаралды 24 МЛН
Stop Writing So Many Tests
10:02
Web Dev Simplified
Рет қаралды 83 М.
Actor Reentrancy in Swift explained
20:18
donny wals
Рет қаралды 1,1 М.
Kotlin Multiplatform as an SDK by Rok Petek
29:31
Infinum
Рет қаралды 106
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 762 М.
Svelte 5's Secret Weapon: Classes + Context
18:14
Huntabyte
Рет қаралды 11 М.
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 252 М.
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
Why Is Lua So Popular?
8:03
Awesome
Рет қаралды 89 М.
Comparing @Observable to ObservableObjects in SwiftUI
12:57
donny wals
Рет қаралды 1,2 М.
Luggage to the Rear 🤣?! 2025 Porsche 911GTS Hybrid #shorts
0:20
thomas.letsgo
Рет қаралды 16 МЛН
I chose the biggest glass 😂👻
0:19
Ben Meryem
Рет қаралды 21 МЛН
ТАТУИРОВКА прозрачной КРАСКОЙ
0:26
Виктор Лодин
Рет қаралды 5 МЛН