Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Fix issues with access modifiers preventing proper behaviour outside …
Browse files Browse the repository at this point in the history
…of the module
  • Loading branch information
nicholascross committed Feb 16, 2019
1 parent 037eb02 commit cb7b462
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions Injectable/DependencyContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object: Injectable>(variant: String?) -> Object {
switch Object.lifetime {
Expand Down
2 changes: 1 addition & 1 deletion Injectable/InjectableObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

}
}
2 changes: 1 addition & 1 deletion InjectableSwift.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit cb7b462

Please sign in to comment.