Nested dependency injection through Property wrapper crashes
问题 Followed this it was working fine. But when I tried the same thing for resolving a nested dependency (Dependency injected class has a dependency in turn - NetworkService In our case), it crashed. What am I doing wrong here? any help would be highly appreciated. A realtime scenario class AppContainer { static let shared = AppContainer() var index: [Any] = [NetworkingLibrary(), NetworkService()] func resolve<T>(_ type: T.Type) -> T { return index.first(where: { $0 as? T != nil }) as! T } }