AliSoftware / Dip

Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances!
MIT License
978 stars 75 forks source link

Fix crash with colaborator containers and weak singletons #182

Closed tapsandswipes closed 6 years ago

tapsandswipes commented 6 years ago

I have an issue with a configuration using a main container created at startup with many factories and bootstrapped and a secondary container that it's dynamically configured during the app lifetime. I sometimes get a crash when resolving weak singletons. The crash points that it can't cast the resolved instance to the required type. This indicates that the resolved instances caches are corrupted at some point.

This same container setup works perfectly with version 5.1 of Dip but I need swift 4 for the next version of the app.

Signed-off-by: Antonio Cabezuelo Vivo antonio@tapsandswipes.com