I definitely prefer the service locator pattern. Sure you can get a crash if you forget a dependency, but that’s something that you should be picking up during development.
What's preventing you from just using the view model factory approach, and make that factory an environment object? Then any view that needs to instantiate another can just refer to factory from its environment
@@DonnyWalsdev Static property 'current' is not concurrency-safe because it is nonisolated global shared mutable state; this is an error in Swift 6 language mode.
@@Avolua ah I see, so that’s entirely unrelated to how you do DI. The compiler is complaining about that property being mutable without any means to ensure data race safety. Making current a let should work, or converting whatever holds that property to an actor might work too. It’s a bit of an annoying error that one because sometimes fixing it will mean you’ll have to move away from static vars (or marking those vars as nonisolated(unsafe))
Yeah I’m not exactly sure what got messed up in processing. The initial upload I had was completely out of sync. This one’s much better in terms of syncing but there’s still something off and I have no idea what it is exactly 😅
Great description and clarity. 👍
Thank you 😁
I definitely prefer the service locator pattern.
Sure you can get a crash if you forget a dependency, but that’s something that you should be picking up during development.
What's preventing you from just using the view model factory approach, and make that factory an environment object? Then any view that needs to instantiate another can just refer to factory from its environment
Nothing, it’d be just another flavor of passing a factory around
I think this throws some warning when swift 6 and complete modes enabled. I was hoping for something compatible with swift 6
Neither DI approach is incompatible with Swift, what kinds of warnings do you get?
@@DonnyWalsdev
Static property 'current' is not concurrency-safe because it is nonisolated global shared mutable state;
this is an error in Swift 6 language mode.
@@Avolua ah I see, so that’s entirely unrelated to how you do DI. The compiler is complaining about that property being mutable without any means to ensure data race safety. Making current a let should work, or converting whatever holds that property to an actor might work too.
It’s a bit of an annoying error that one because sometimes fixing it will mean you’ll have to move away from static vars (or marking those vars as nonisolated(unsafe))
There is something weird with the audio processing
Yeah I’m not exactly sure what got messed up in processing. The initial upload I had was completely out of sync. This one’s much better in terms of syncing but there’s still something off and I have no idea what it is exactly 😅