Closed Anavrin1990 closed 5 years ago
No, it is work for classes with init without parameters. I don't know why it is happening
Please write swift version. I check tests on swift 5.0,4.2, 4.0 and it's works.
But on version 3.x it's doen't work - I wrote about it in version 3.7.0.
If swift version 4.0 and greatest please write one full test. I cann't reproduce.
I found problem.
DisposeBag
have more initialization method:
public override init()
public convenience init(disposing disposables: Disposable...)
public convenience init(disposing disposables: [Disposable])
And library can't decide I think your viewController have two initializations:
init(disposebag: DisposeBag)
init(nibName:bundle:)
In old realizations for one parameter registers need wrote register1
- this cut off part of the options.
But now have only register
.
Please use other syntax;
container.register(ViewController.init())
container.register { ViewController() }
container.register(ViewController.init(nibName:bundle:))
container.register { ViewController(nibName: $0, bundle: $1) }
container.register(ViewController.init(disposebag:))
container.register { ViewController(disposebag: $0) }
container.register(DisposeBag.init())
container.register { DisposeBag() }
container.register(DisposeBag.init(disposing:))
container.register { DisposeBag(disposing: $0) }
to specify the initialization method exactly. or remove(or change access level to private) other initialization methods.
Thank you This syntax doesn't work container.register(DisposeBag.init()) but This work perfect container.register { DisposeBag() }
This form of register doesn't work for classes with init without parameters only this form container.register{ClassName()}