Hello. Can I do something like this?
typealias UserSession = UserLogin & UserLogout
container.register(UserSession.self) { r in
UserSessionManager(network: r.resolve(LoginService.self)!,
keychain: r.resolve(KeychainWrapper.self)!)
}
and then call
r.resolve(UserLogin.self)!
Hi @vidrilla,
Swinject is matching exact types, so just like that it would not work. However, you could add:
container.register(UserLogin.self) { r in r.resolve(UserSession.self)! }
container.register(UserLogout.self) { r in r.resolve(UserSession.self)! }
to make resolution of partial protocols work
@vidrilla, please feel free to reopen this issue if the issue is not resolved.
Most helpful comment
Hi @vidrilla,
Swinject is matching exact types, so just like that it would not work. However, you could add:
to make resolution of partial protocols work