Skip to content

Commit

Permalink
Updating for Swift 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jkolb committed Feb 12, 2015
1 parent 2af158d commit d4aabc3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions FieryCrucible/DependencyFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class DependencyFactory {

public init() { }

public func shared<T>(name: String, factory: @autoclosure () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
public func shared<T>(name: String, @autoclosure factory: () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
return inject(
lifecyle: .Shared,
name: name,
Expand All @@ -94,7 +94,7 @@ public class DependencyFactory {
)
}

public func weakShared<T: AnyObject>(name: String, factory: @autoclosure () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
public func weakShared<T: AnyObject>(name: String, @autoclosure factory: () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
return inject(
lifecyle: .WeakShared,
name: name,
Expand All @@ -105,7 +105,7 @@ public class DependencyFactory {
)
}

public func unshared<T>(name: String, factory: @autoclosure () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
public func unshared<T>(name: String, @autoclosure factory: () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
var unsharedInstances: [String:AnyObject] = [:]
return inject(
lifecyle: .Unshared,
Expand All @@ -117,7 +117,7 @@ public class DependencyFactory {
)
}

public func scoped<T>(name: String, factory: @autoclosure () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
public func scoped<T>(name: String, @autoclosure factory: () -> T, configure configureOrNil: ((T) -> ())? = nil) -> T {
return inject(
lifecyle: .Scoped,
name: name,
Expand All @@ -128,7 +128,7 @@ public class DependencyFactory {
)
}

func inject<T, C: InstanceContainer where C.InstanceType == T>(# lifecyle: Lifecyle, name: String, inout instancePool: [String:AnyObject], containerFactory: (T) -> C, factory: @autoclosure () -> T, configure configureOrNil: ((T) -> ())?) -> T {
func inject<T, C: InstanceContainer where C.InstanceType == T>(# lifecyle: Lifecyle, name: String, inout instancePool: [String:AnyObject], containerFactory: (T) -> C, @autoclosure factory: () -> T, configure configureOrNil: ((T) -> ())?) -> T {
if let container = instancePool[name] as? C {
if let instance = container.instance {
return instance
Expand Down

0 comments on commit d4aabc3

Please sign in to comment.