Skip to content

Commit

Permalink
Added new form of method where the factory allows configuration of th…
Browse files Browse the repository at this point in the history
…e object at an earlier point in time in the request.

Removed unused test target.
Added LICENSE and README.md so they are visible when the project file is open.
  • Loading branch information
jkolb committed Jan 29, 2016
1 parent 3af08e1 commit 40cef64
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 225 deletions.
136 changes: 6 additions & 130 deletions FieryCrucible.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,16 @@

/* Begin PBXBuildFile section */
E53405B01A3020CE00A474C1 /* FieryCrucible.h in Headers */ = {isa = PBXBuildFile; fileRef = E53405AF1A3020CE00A474C1 /* FieryCrucible.h */; settings = {ATTRIBUTES = (Public, ); }; };
E53405B61A3020CF00A474C1 /* FieryCrucible.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E53405AA1A3020CE00A474C1 /* FieryCrucible.framework */; };
E53405BD1A3020CF00A474C1 /* FieryCrucibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E53405BC1A3020CF00A474C1 /* FieryCrucibleTests.swift */; };
E5A928C81A32C0B60071875D /* DependencyFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5A928C71A32C0B60071875D /* DependencyFactory.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
E53405B71A3020CF00A474C1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E53405A11A3020CE00A474C1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = E53405A91A3020CE00A474C1;
remoteInfo = FieryCrucible;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
E53405AA1A3020CE00A474C1 /* FieryCrucible.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FieryCrucible.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E53405AE1A3020CE00A474C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E53405AF1A3020CE00A474C1 /* FieryCrucible.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FieryCrucible.h; sourceTree = "<group>"; };
E53405B51A3020CF00A474C1 /* FieryCrucibleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FieryCrucibleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E53405BB1A3020CF00A474C1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E53405BC1A3020CF00A474C1 /* FieryCrucibleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieryCrucibleTests.swift; sourceTree = "<group>"; };
E5A928C71A32C0B60071875D /* DependencyFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DependencyFactory.swift; sourceTree = "<group>"; };
E5F98A491C5B13300072BAF8 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
E5F98A4B1C5B13370072BAF8 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -41,22 +28,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E53405B21A3020CF00A474C1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E53405B61A3020CF00A474C1 /* FieryCrucible.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
E53405A01A3020CE00A474C1 = {
isa = PBXGroup;
children = (
E5F98A4B1C5B13370072BAF8 /* README.md */,
E5F98A491C5B13300072BAF8 /* LICENSE */,
E53405AC1A3020CE00A474C1 /* FieryCrucible */,
E53405B91A3020CF00A474C1 /* FieryCrucibleTests */,
E53405AB1A3020CE00A474C1 /* Products */,
);
sourceTree = "<group>";
Expand All @@ -65,7 +45,6 @@
isa = PBXGroup;
children = (
E53405AA1A3020CE00A474C1 /* FieryCrucible.framework */,
E53405B51A3020CF00A474C1 /* FieryCrucibleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand All @@ -88,23 +67,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
E53405B91A3020CF00A474C1 /* FieryCrucibleTests */ = {
isa = PBXGroup;
children = (
E53405BC1A3020CF00A474C1 /* FieryCrucibleTests.swift */,
E53405BA1A3020CF00A474C1 /* Supporting Files */,
);
path = FieryCrucibleTests;
sourceTree = "<group>";
};
E53405BA1A3020CF00A474C1 /* Supporting Files */ = {
isa = PBXGroup;
children = (
E53405BB1A3020CF00A474C1 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -137,24 +99,6 @@
productReference = E53405AA1A3020CE00A474C1 /* FieryCrucible.framework */;
productType = "com.apple.product-type.framework";
};
E53405B41A3020CF00A474C1 /* FieryCrucibleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = E53405C31A3020CF00A474C1 /* Build configuration list for PBXNativeTarget "FieryCrucibleTests" */;
buildPhases = (
E53405B11A3020CF00A474C1 /* Sources */,
E53405B21A3020CF00A474C1 /* Frameworks */,
E53405B31A3020CF00A474C1 /* Resources */,
);
buildRules = (
);
dependencies = (
E53405B81A3020CF00A474C1 /* PBXTargetDependency */,
);
name = FieryCrucibleTests;
productName = FieryCrucibleTests;
productReference = E53405B51A3020CF00A474C1 /* FieryCrucibleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand All @@ -168,9 +112,6 @@
E53405A91A3020CE00A474C1 = {
CreatedOnToolsVersion = 6.1.1;
};
E53405B41A3020CF00A474C1 = {
CreatedOnToolsVersion = 6.1.1;
};
};
};
buildConfigurationList = E53405A41A3020CE00A474C1 /* Build configuration list for PBXProject "FieryCrucible" */;
Expand All @@ -186,7 +127,6 @@
projectRoot = "";
targets = (
E53405A91A3020CE00A474C1 /* FieryCrucible */,
E53405B41A3020CF00A474C1 /* FieryCrucibleTests */,
);
};
/* End PBXProject section */
Expand All @@ -199,13 +139,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E53405B31A3020CF00A474C1 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -217,24 +150,8 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E53405B11A3020CF00A474C1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E53405BD1A3020CF00A474C1 /* FieryCrucibleTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
E53405B81A3020CF00A474C1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = E53405A91A3020CE00A474C1 /* FieryCrucible */;
targetProxy = E53405B71A3020CF00A474C1 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
E53405BE1A3020CF00A474C1 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -272,7 +189,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -312,7 +229,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down Expand Up @@ -355,38 +272,6 @@
};
name = Release;
};
E53405C41A3020CF00A474C1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = FieryCrucibleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
E53405C51A3020CF00A474C1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = FieryCrucibleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.franticapparatus.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand All @@ -408,15 +293,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E53405C31A3020CF00A474C1 /* Build configuration list for PBXNativeTarget "FieryCrucibleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E53405C41A3020CF00A474C1 /* Debug */,
E53405C51A3020CF00A474C1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E53405A11A3020CE00A474C1 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E53405B41A3020CF00A474C1"
BuildableName = "FieryCrucibleTests.xctest"
BlueprintName = "FieryCrucibleTests"
ReferencedContainer = "container:FieryCrucible.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand Down
31 changes: 21 additions & 10 deletions FieryCrucible/DependencyFactory.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//
// DependencyFactory.swift
// FieryCrucible
//
// Copyright (c) 2015 Justin Kolb - http://franticapparatus.net
// Copyright (c) 2016 Justin Kolb - http://franticapparatus.net
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,7 +17,6 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

private protocol InstanceContainer : class {
typealias InstanceType
Expand Down Expand Up @@ -90,7 +85,11 @@ public class DependencyFactory {
private var requestDepth = 0

public init() { }


public final func shared<T>(@noescape factory factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return shared(name, factory: factory(), configure: configure)
}

public final func shared<T>(@autoclosure factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return shared(name, factory: factory, configure: configure)
}
Expand All @@ -105,7 +104,11 @@ public class DependencyFactory {
configure: configure
)
}


public final func weakShared<T: AnyObject>(@noescape factory factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return weakShared(name, factory: factory(), configure: configure)
}

public final func weakShared<T: AnyObject>(@autoclosure factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return weakShared(name, factory: factory, configure: configure)
}
Expand All @@ -120,7 +123,11 @@ public class DependencyFactory {
configure: configure
)
}


public final func unshared<T>(@noescape factory factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return unshared(name, factory: factory(), configure: configure)
}

public final func unshared<T>(@autoclosure factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return unshared(name, factory: factory, configure: configure)
}
Expand All @@ -136,7 +143,11 @@ public class DependencyFactory {
configure: configure
)
}


public final func scoped<T>(@noescape factory factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return scoped(name, factory: factory(), configure: configure)
}

public final func scoped<T>(@autoclosure factory: () -> T, name: String = __FUNCTION__, configure: ((T) -> ())? = nil) -> T {
return scoped(name, factory: factory, configure: configure)
}
Expand Down
14 changes: 1 addition & 13 deletions FieryCrucible/FieryCrucible.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//
// FieryCrucible.h
// FieryCrucible
//
// Copyright (c) 2015 Justin Kolb - http://franticapparatus.net
// Copyright (c) 2016 Justin Kolb - http://franticapparatus.net
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,16 +17,8 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import <UIKit/UIKit.h>

//! Project version number for FieryCrucible.
FOUNDATION_EXPORT double FieryCrucibleVersionNumber;

//! Project version string for FieryCrucible.
FOUNDATION_EXPORT const unsigned char FieryCrucibleVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <FieryCrucible/PublicHeader.h>


4 changes: 2 additions & 2 deletions FieryCrucible/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<string>1.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.0</string>
<string>1.3.1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
Loading

0 comments on commit 40cef64

Please sign in to comment.