hi, I found this error " Unexpectedly found nil while unwrapping an Optional value: file Sociobox/ProfileContentProvider.swift, line 55
user: User = DIContainer.shared.resolve(type: User.self)!,
Yes I got the same. It is because the Container is not properly initialised. Try to follow until she writes: “Build and run”, before the " Extending the Functionality" paragraph.
It works for me after I added the code in SceneDelegate!
Thanks for sharing your knowledge. I was hoping the Tutorial could include some important cases that are not explained when trying to do dependency injection with SwiftUI. In particular when a View has @StateObject it seems SwiftUI doesn’t like us to use dependency injection. So if you could include how to add dependencies like @StateObject, @State and @Binding will be great.
ProfileView does not contain the same code as in does in the article under ’ Identifying the Issue’ section. Perhaps we’re suppose to add the if/else and remove the provider.friendsView, etc, but that’s not clear.