diff --git a/Injectable/DependencyContainer.swift b/Injectable/DependencyContainer.swift index db0c01a..0843de6 100644 --- a/Injectable/DependencyContainer.swift +++ b/Injectable/DependencyContainer.swift @@ -9,10 +9,21 @@ import Foundation public class DependencyContainer: Container { - private var transientObjects: [String: AnyObject] = [:] - private var persistentObjects: [String: AnyObject] = [:] - private let lock: RecursiveLock = .init() - private var registeredResolvers: [String: (Container) -> Any] = [:] + private var transientObjects: [String: AnyObject] + private var persistentObjects: [String: AnyObject] + private let lock: RecursiveLock + private var registeredResolvers: [String: (Container) -> Any] + + public convenience init() { + self.init(transientObjects: [:], persistentObjects: [:], lock: .init(), registeredResolvers: [:]) + } + + init(transientObjects: [String: AnyObject], persistentObjects: [String: AnyObject], lock: RecursiveLock, registeredResolvers: [String: (Container) -> Any]) { + self.transientObjects = transientObjects + self.persistentObjects = persistentObjects + self.lock = lock + self.registeredResolvers = registeredResolvers + } public func resolve(variant: String?) -> Object { switch Object.lifetime { diff --git a/Injectable/InjectableObject.swift b/Injectable/InjectableObject.swift index ef6bb91..f789774 100644 --- a/Injectable/InjectableObject.swift +++ b/Injectable/InjectableObject.swift @@ -17,7 +17,7 @@ public protocol InjectableObject { } extension InjectableObject { - static func didCreate(object: InjectedType, inContainer container: Container) { + public static func didCreate(object: InjectedType, inContainer container: Container) { } } diff --git a/InjectableSwift.podspec b/InjectableSwift.podspec index 455c83f..00b77ac 100644 --- a/InjectableSwift.podspec +++ b/InjectableSwift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "InjectableSwift" - s.version = "0.1.4" + s.version = "0.2.0" s.summary = "A Swift dependency injection container" s.description = <<-DESC A Swift dependency injection container which minimises the need for centralised registration