diff --git a/Sources/EasyDi.swift b/Sources/EasyDi.swift index 1accd07..d60fef6 100644 --- a/Sources/EasyDi.swift +++ b/Sources/EasyDi.swift @@ -365,9 +365,11 @@ open class Assembly: AssemblyInternal { result = singleton as! ObjectType // And trying to return object from graph - } else if let objectFromStack = context.objectGraphStorage[key] as? ObjectType, scope != .prototype { + } else if let objectFromStack = context.objectGraphStorage[key], + scope != .prototype, + let unwrappedObject = objectFromStack as? ObjectType { - result = objectFromStack + result = unwrappedObject } else {