AliSoftware/Dip

Register with Scope and Factory

bhushans opened this issue · 1 comments

Hello,

I have a generic functions that used to use for registering the factory.
However, when I try to do it now, it starts throwing error
Cannot invoke 'register' with an argument list of type '(ComponentScope, factory: () throws -> T)'

Here is the function.
open func register(_ factory: () throws -> T) {
recordMethods(T.self as! CDVPlugin.Type)
container.register(DefaultScope, factory: factory)
}

I was able to resolve this issue by add @escaping before the closure.