Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| feb5064b93 | |||
| 184e1f4543 | |||
| 8be1139114 | |||
| afc8e49b18 | |||
| 333fa96b62 | |||
| d611ea240e | |||
| ee16baacfc | |||
| b4221e25a1 | |||
| 0edd3747e8 | |||
| 2708f7e434 | |||
| 378432e376 | |||
| 62b99edb59 | |||
| 4166afa387 | |||
| b15fc47935 | |||
| 5623ff9d13 | |||
| 79ef7e72f5 | |||
| aacf2adbd3 | |||
| bc516a3cc3 | |||
| 66ef3f7697 | |||
| 794dec0d95 | |||
| 3f0d66bbd9 | |||
| 24e5c002ed | |||
| 3317a9d994 | |||
| 53c770c7fc | |||
| 04a6230dd8 | |||
| 5adb520a69 | |||
| 69da1b0e1f | |||
| 4e101cab4d | |||
| a985ccb407 | |||
| 42ea4b155b | |||
| 3ccbff4780 | |||
| 72663deec7 | |||
| b9bf2da0d4 | |||
| 89acac24c5 | |||
| 2ea5e17a51 | |||
| f1c7c52f14 | |||
| ae04c11ae8 | |||
| b5fca0a306 | |||
| 04aa2e190e | |||
| e97e3974d2 | |||
| 6faf08096a | |||
| 23924ce4a4 | |||
| 85807fea9c | |||
| ecac5ce29f | |||
| fbd4cb8321 | |||
| 9e528da256 | |||
| ec3d979391 | |||
| 25ef719be0 | |||
| a37a8f2dbb | |||
| 1de582a2a5 | |||
| 7952c0850a | |||
| 156347d5c2 | |||
| dbc8900270 | |||
| 6162c26963 |
@@ -2,14 +2,14 @@ language: objective-c
|
||||
osx_image: xcode7
|
||||
|
||||
# cache: cocoapods
|
||||
# podfile: Example/Podfile
|
||||
# before_install:
|
||||
# - gem install cocoapods # Since Travis is not always on latest version
|
||||
# - pod install --project-directory=Example
|
||||
|
||||
install:
|
||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
|
||||
script:
|
||||
- set -o pipefail && xcodebuild test -workspace Example/Dip.xcworkspace -scheme DipSampleApp -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' ONLY_ACTIVE_ARCH=NO | xcpretty -c
|
||||
- set -o pipefail && xcodebuild test -workspace Dip.xcworkspace -scheme Dip -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' ONLY_ACTIVE_ARCH=NO | xcpretty -c
|
||||
- set -o pipefail && xcodebuild test -workspace Dip.xcworkspace -scheme DipSampleApp -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' ONLY_ACTIVE_ARCH=NO | xcpretty -c
|
||||
- pod lib lint --quick
|
||||
|
||||
|
||||
@@ -1,5 +1,45 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 3.1.0
|
||||
|
||||
#### New
|
||||
|
||||
* Added name for the first runtime argument in `resolve(tag:withArguments: … )` methods to make more clear separation between tag and factory runtime arguments.
|
||||
|
||||
#### Depreciations
|
||||
|
||||
* `resolve(tag:_: … )` methods are deprecated in favor of those new `resolve(tag:withArguments: … )` methods.
|
||||
* Deprecated `register(tag:instance:)` method in favor of `register(.Singleton) { … }`.
|
||||
|
||||
## 3.0.0
|
||||
|
||||
* Added support for factories with up to six runtime arguments.
|
||||
[#8](https://github.com/AliSoftware/Dip/pull/8), [@ilyapuchka](https://github.com/ilyapuchka)
|
||||
* Parameter `tag` is now named in all register/resolve methods.
|
||||
* Playground added to project.
|
||||
[#10](https://github.com/AliSoftware/Dip/pull/10), [@ilyapuchka](https://github.com/ilyapuchka)
|
||||
|
||||
### Note on migration from 2.0.0 to 3.0.0:
|
||||
|
||||
If you used tags to register and resolve your components you have to add `tag` name for tag parameter. Don't forget to add it both in `register` and `resolve` methods. If you forget to add it in `resolve` call then tag value will be treated as first runtime argument for a factory, but there is no such factory registerd, so resolve will fail.
|
||||
|
||||
**Example**:
|
||||
|
||||
This code:
|
||||
|
||||
```swift
|
||||
container.register("some tag") { SomeClass() as SomeProtocol }
|
||||
container.resolve("some tag") as SomeProtocol
|
||||
```
|
||||
|
||||
becomes this:
|
||||
|
||||
```swift
|
||||
container.register(tag: "some tag") { SomeClass() as SomeProtocol }
|
||||
container.resolve(tag: "some tag") as SomeProtocol
|
||||
```
|
||||
|
||||
|
||||
## 2.0.0
|
||||
|
||||
* Moved from generic _tag_ parameter on container to `Tag` enum with `String` and `Int` cases
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Dip"
|
||||
s.version = "2.0.0"
|
||||
s.version = "3.1.0"
|
||||
s.summary = "A simple Dependency Resolver: Dependency Injection using Protocol resolution."
|
||||
|
||||
s.description = <<-DESC
|
||||
@@ -26,5 +26,5 @@ Pod::Spec.new do |s|
|
||||
s.platform = :ios, '8.0'
|
||||
s.requires_arc = true
|
||||
|
||||
s.source_files = 'Sources/**/*'
|
||||
s.source_files = 'Dip/Dip/**/*'
|
||||
end
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:DipPlayground.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Dip/Dip.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:SampleApp/DipSampleApp.xcodeproj">
|
||||
</FileRef>
|
||||
<Group
|
||||
location = "container:"
|
||||
name = "Podspec Metadata">
|
||||
<FileRef
|
||||
location = "group:Dip.podspec">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:README.md">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:LICENSE">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:CHANGELOG.md">
|
||||
</FileRef>
|
||||
</Group>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,416 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
094526951BEA1CFF0034E72A /* Dip.h in Headers */ = {isa = PBXBuildFile; fileRef = 094526941BEA1CFF0034E72A /* Dip.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0945269C1BEA1CFF0034E72A /* Dip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 094526911BEA1CFF0034E72A /* Dip.framework */; };
|
||||
094526A11BEA1CFF0034E72A /* DipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094526A01BEA1CFF0034E72A /* DipTests.swift */; };
|
||||
094526AC1BEA1D200034E72A /* Dip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094526AB1BEA1D200034E72A /* Dip.swift */; };
|
||||
094526B41BEA51540034E72A /* RuntimeArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094526B31BEA51540034E72A /* RuntimeArguments.swift */; };
|
||||
094526B61BEA520B0034E72A /* Definition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094526B51BEA520B0034E72A /* Definition.swift */; };
|
||||
094526B81BEA536A0034E72A /* RuntimeArgumentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 094526B71BEA536A0034E72A /* RuntimeArgumentsTests.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
0945269D1BEA1CFF0034E72A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 094526881BEA1CFF0034E72A /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 094526901BEA1CFF0034E72A;
|
||||
remoteInfo = Dip;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
094526911BEA1CFF0034E72A /* Dip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Dip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
094526941BEA1CFF0034E72A /* Dip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Dip.h; sourceTree = "<group>"; };
|
||||
094526961BEA1CFF0034E72A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
0945269B1BEA1CFF0034E72A /* DipTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DipTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
094526A01BEA1CFF0034E72A /* DipTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DipTests.swift; sourceTree = "<group>"; };
|
||||
094526A21BEA1CFF0034E72A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
094526AB1BEA1D200034E72A /* Dip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dip.swift; sourceTree = "<group>"; };
|
||||
094526B31BEA51540034E72A /* RuntimeArguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = RuntimeArguments.swift; sourceTree = "<group>"; tabWidth = 2; };
|
||||
094526B51BEA520B0034E72A /* Definition.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = Definition.swift; sourceTree = "<group>"; tabWidth = 2; };
|
||||
094526B71BEA536A0034E72A /* RuntimeArgumentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RuntimeArgumentsTests.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
0945268D1BEA1CFF0034E72A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
094526981BEA1CFF0034E72A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0945269C1BEA1CFF0034E72A /* Dip.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
094526871BEA1CFF0034E72A = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
094526931BEA1CFF0034E72A /* Dip */,
|
||||
0945269F1BEA1CFF0034E72A /* DipTests */,
|
||||
094526921BEA1CFF0034E72A /* Products */,
|
||||
);
|
||||
indentWidth = 2;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 2;
|
||||
};
|
||||
094526921BEA1CFF0034E72A /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
094526911BEA1CFF0034E72A /* Dip.framework */,
|
||||
0945269B1BEA1CFF0034E72A /* DipTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
094526931BEA1CFF0034E72A /* Dip */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
094526941BEA1CFF0034E72A /* Dip.h */,
|
||||
094526AB1BEA1D200034E72A /* Dip.swift */,
|
||||
094526B31BEA51540034E72A /* RuntimeArguments.swift */,
|
||||
094526B51BEA520B0034E72A /* Definition.swift */,
|
||||
094526961BEA1CFF0034E72A /* Info.plist */,
|
||||
);
|
||||
path = Dip;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0945269F1BEA1CFF0034E72A /* DipTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
094526A01BEA1CFF0034E72A /* DipTests.swift */,
|
||||
094526B71BEA536A0034E72A /* RuntimeArgumentsTests.swift */,
|
||||
094526A21BEA1CFF0034E72A /* Info.plist */,
|
||||
);
|
||||
path = DipTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
0945268E1BEA1CFF0034E72A /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
094526951BEA1CFF0034E72A /* Dip.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
094526901BEA1CFF0034E72A /* Dip */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 094526A51BEA1CFF0034E72A /* Build configuration list for PBXNativeTarget "Dip" */;
|
||||
buildPhases = (
|
||||
0945268C1BEA1CFF0034E72A /* Sources */,
|
||||
0945268D1BEA1CFF0034E72A /* Frameworks */,
|
||||
0945268E1BEA1CFF0034E72A /* Headers */,
|
||||
0945268F1BEA1CFF0034E72A /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Dip;
|
||||
productName = Dip;
|
||||
productReference = 094526911BEA1CFF0034E72A /* Dip.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
0945269A1BEA1CFF0034E72A /* DipTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 094526A81BEA1CFF0034E72A /* Build configuration list for PBXNativeTarget "DipTests" */;
|
||||
buildPhases = (
|
||||
094526971BEA1CFF0034E72A /* Sources */,
|
||||
094526981BEA1CFF0034E72A /* Frameworks */,
|
||||
094526991BEA1CFF0034E72A /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
0945269E1BEA1CFF0034E72A /* PBXTargetDependency */,
|
||||
);
|
||||
name = DipTests;
|
||||
productName = DipTests;
|
||||
productReference = 0945269B1BEA1CFF0034E72A /* DipTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
094526881BEA1CFF0034E72A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0710;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = AliSoftware;
|
||||
TargetAttributes = {
|
||||
094526901BEA1CFF0034E72A = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
0945269A1BEA1CFF0034E72A = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 0945268B1BEA1CFF0034E72A /* Build configuration list for PBXProject "Dip" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 094526871BEA1CFF0034E72A;
|
||||
productRefGroup = 094526921BEA1CFF0034E72A /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
094526901BEA1CFF0034E72A /* Dip */,
|
||||
0945269A1BEA1CFF0034E72A /* DipTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
0945268F1BEA1CFF0034E72A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
094526991BEA1CFF0034E72A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0945268C1BEA1CFF0034E72A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
094526AC1BEA1D200034E72A /* Dip.swift in Sources */,
|
||||
094526B61BEA520B0034E72A /* Definition.swift in Sources */,
|
||||
094526B41BEA51540034E72A /* RuntimeArguments.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
094526971BEA1CFF0034E72A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
094526A11BEA1CFF0034E72A /* DipTests.swift in Sources */,
|
||||
094526B81BEA536A0034E72A /* RuntimeArgumentsTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
0945269E1BEA1CFF0034E72A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 094526901BEA1CFF0034E72A /* Dip */;
|
||||
targetProxy = 0945269D1BEA1CFF0034E72A /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
094526A31BEA1CFF0034E72A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.1.0;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
094526A41BEA1CFF0034E72A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.1.0;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
094526A61BEA1CFF0034E72A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Dip/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.Dip;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
094526A71BEA1CFF0034E72A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Dip/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.Dip;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
094526A91BEA1CFF0034E72A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = DipTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.DipTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
094526AA1BEA1CFF0034E72A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = DipTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alisoftware.DipTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
0945268B1BEA1CFF0034E72A /* Build configuration list for PBXProject "Dip" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
094526A31BEA1CFF0034E72A /* Debug */,
|
||||
094526A41BEA1CFF0034E72A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
094526A51BEA1CFF0034E72A /* Build configuration list for PBXNativeTarget "Dip" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
094526A61BEA1CFF0034E72A /* Debug */,
|
||||
094526A71BEA1CFF0034E72A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
094526A81BEA1CFF0034E72A /* Build configuration list for PBXNativeTarget "DipTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
094526A91BEA1CFF0034E72A /* Debug */,
|
||||
094526AA1BEA1CFF0034E72A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 094526881BEA1CFF0034E72A /* Project object */;
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:../DipPlayground.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0710"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "094526901BEA1CFF0034E72A"
|
||||
BuildableName = "Dip.framework"
|
||||
BlueprintName = "Dip"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0945269A1BEA1CFF0034E72A"
|
||||
BuildableName = "DipTests.xctest"
|
||||
BlueprintName = "DipTests"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "094526901BEA1CFF0034E72A"
|
||||
BuildableName = "Dip.framework"
|
||||
BlueprintName = "Dip"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "094526901BEA1CFF0034E72A"
|
||||
BuildableName = "Dip.framework"
|
||||
BlueprintName = "Dip"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "094526901BEA1CFF0034E72A"
|
||||
BuildableName = "Dip.framework"
|
||||
BlueprintName = "Dip"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// Dip
|
||||
//
|
||||
// Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// 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 Foundation
|
||||
|
||||
///Internal representation of a key used to associate definitons and factories by tag, type and factory.
|
||||
struct DefinitionKey : Hashable, Equatable, CustomDebugStringConvertible {
|
||||
var protocolType: Any.Type
|
||||
var factoryType: Any.Type
|
||||
var associatedTag: DependencyContainer.Tag?
|
||||
|
||||
var hashValue: Int {
|
||||
return "\(protocolType)-\(factoryType)-\(associatedTag)".hashValue
|
||||
}
|
||||
|
||||
var debugDescription: String {
|
||||
return "type: \(protocolType), factory: \(factoryType), tag: \(associatedTag)"
|
||||
}
|
||||
}
|
||||
|
||||
func ==(lhs: DefinitionKey, rhs: DefinitionKey) -> Bool {
|
||||
return
|
||||
lhs.protocolType == rhs.protocolType &&
|
||||
lhs.factoryType == rhs.factoryType &&
|
||||
lhs.associatedTag == rhs.associatedTag
|
||||
}
|
||||
|
||||
///Describes the lifecycle of instances created by container.
|
||||
public enum ComponentScope {
|
||||
/// Indicates that a new instance of the component will be created each time it's resolved.
|
||||
case Prototype
|
||||
/// Indicates that resolved component should be retained by container and always reused.
|
||||
case Singleton
|
||||
}
|
||||
|
||||
///Definition of type T describes how instances of this type should be created when they are resolved by container.
|
||||
public final class DefinitionOf<T>: Definition {
|
||||
let factory: Any
|
||||
let scope: ComponentScope
|
||||
|
||||
init(factory: Any, scope: ComponentScope = .Prototype) {
|
||||
self.factory = factory
|
||||
self.scope = scope
|
||||
}
|
||||
|
||||
var resolvedInstance: T? {
|
||||
get {
|
||||
guard scope == .Singleton else { return nil }
|
||||
return _resolvedInstance
|
||||
}
|
||||
set {
|
||||
guard scope == .Singleton else { return }
|
||||
_resolvedInstance = newValue
|
||||
}
|
||||
}
|
||||
|
||||
private var _resolvedInstance: T?
|
||||
}
|
||||
|
||||
///Dummy protocol to store definitions for different types in collection
|
||||
protocol Definition {}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Dip.h
|
||||
// Dip
|
||||
//
|
||||
// Created by Ilya Puchka on 04.11.15.
|
||||
// Copyright © 2015 AliSoftware. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for Dip.
|
||||
FOUNDATION_EXPORT double DipVersionNumber;
|
||||
|
||||
//! Project version string for Dip.
|
||||
FOUNDATION_EXPORT const unsigned char DipVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Dip/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// Dip
|
||||
//
|
||||
// Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// 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 Foundation
|
||||
|
||||
// MARK: - DependencyContainer
|
||||
|
||||
/**
|
||||
* _Dip_'s Dependency Containers allow you to do very simple **Dependency Injection**
|
||||
* by associating `protocols` to concrete implementations
|
||||
*/
|
||||
public class DependencyContainer {
|
||||
|
||||
/**
|
||||
Use a tag in case you need to register multiple instances or factories
|
||||
with the same protocol, to differentiate them. Tags can be either String
|
||||
or Int, to your convenience.
|
||||
*/
|
||||
public enum Tag: Equatable {
|
||||
case String(StringLiteralType)
|
||||
case Int(IntegerLiteralType)
|
||||
}
|
||||
|
||||
private var dependencies = [DefinitionKey : Definition]()
|
||||
private var lock: OSSpinLock = OS_SPINLOCK_INIT
|
||||
|
||||
/**
|
||||
Designated initializer for a DependencyContainer
|
||||
|
||||
- parameter configBlock: A configuration block in which you typically put all you `register` calls.
|
||||
|
||||
- note: The `configBlock` is simply called at the end of the `init` to let you configure everything.
|
||||
It is only present for convenience to have a cleaner syntax when declaring and initializing
|
||||
your `DependencyContainer` instances.
|
||||
|
||||
- returns: A new DependencyContainer.
|
||||
*/
|
||||
public init(@noescape configBlock: (DependencyContainer->()) = { _ in }) {
|
||||
configBlock(self)
|
||||
}
|
||||
|
||||
// MARK: - Reset all dependencies
|
||||
|
||||
/**
|
||||
Clear all the previously registered dependencies on this container.
|
||||
*/
|
||||
public func reset() {
|
||||
lockAndDo {
|
||||
dependencies.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Register dependencies
|
||||
|
||||
/**
|
||||
Register a Void->T factory associated with optional tag.
|
||||
|
||||
- parameter tag: The arbitrary tag to associate this factory with when registering with that protocol. Pass `nil` to associate with any tag. Default value is `nil`.
|
||||
- parameter factory: The factory to register, with return type of protocol you want to register it for
|
||||
|
||||
- note: You must cast the factory return type to the protocol you want to register it with (e.g `MyClass() as MyAPI`)
|
||||
*/
|
||||
public func register<T>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: ()->T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/**
|
||||
Register a Singleton instance associated with optional tag.
|
||||
|
||||
- parameter tag: The arbitrary tag to associate this instance with when registering with that protocol. `nil` to associate with any tag.
|
||||
- parameter instance: The instance to register, with return type of protocol you want to register it for
|
||||
|
||||
- note: You must cast the instance to the protocol you want to register it with (e.g `MyClass() as MyAPI`)
|
||||
|
||||
**Deprecated**: Use `register(.Singleton){}` method instead to define singleton scope.
|
||||
*/
|
||||
|
||||
@available(*, deprecated, message="Use `register(.Singleton){}` method instead to define singleton scope.")
|
||||
public func register<T>(tag tag: Tag? = nil, @autoclosure(escaping) instance factory: ()->T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: { factory() }, scope: .Singleton)
|
||||
}
|
||||
|
||||
/**
|
||||
Register generic factory associated with optional tag.
|
||||
|
||||
- parameter tag: The arbitrary tag to look for when resolving this protocol.
|
||||
- parameter factory: generic factory that should be used to create concrete instance of type
|
||||
- parameter scope: scope of the component. Default value is `Prototype`
|
||||
|
||||
- note: You should not call this method directly, instead call any of other `register` methods.
|
||||
You _should_ use this method only to register dependency with more runtime arguments
|
||||
than _Dip_ supports (currently it's up to six) like in this example:
|
||||
|
||||
```swift
|
||||
public func register<T, Arg1, Arg2, Arg3, ...>(tag: Tag? = nil, factory: (Arg1, Arg2, Arg3, ...) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: .Prototype) as DefinitionOf<T>
|
||||
}
|
||||
```
|
||||
|
||||
Though before you do that you should probably review your design and try to reduce number of depnedencies.
|
||||
|
||||
*/
|
||||
public func register<T, F>(tag tag: Tag? = nil, factory: F, scope: ComponentScope) -> DefinitionOf<T> {
|
||||
let key = DefinitionKey(protocolType: T.self, factoryType: F.self, associatedTag: tag)
|
||||
let definition = DefinitionOf<T>(factory: factory, scope: scope)
|
||||
lockAndDo {
|
||||
dependencies[key] = definition
|
||||
}
|
||||
return definition
|
||||
}
|
||||
|
||||
// MARK: Resolve dependencies
|
||||
|
||||
/**
|
||||
Resolve a dependency.
|
||||
|
||||
If no instance/factory was registered with this `tag` for this `protocol`, it will try to resolve the instance/factory associated with `nil` (no tag).
|
||||
|
||||
- parameter tag: The arbitrary tag to look for when resolving this protocol.
|
||||
*/
|
||||
public func resolve<T>(tag tag: Tag? = nil) -> T {
|
||||
return resolve(tag: tag) { (factory: ()->T) in factory() }
|
||||
}
|
||||
|
||||
/**
|
||||
Resolve a dependency using generic builder closure that accepts generic factory and returns created instance.
|
||||
|
||||
- parameter tag: The arbitrary tag to look for when resolving this protocol.
|
||||
- parameter builder: Generic closure that accepts generic factory and returns inctance produced by that factory
|
||||
|
||||
- note: You should not call this method directly, instead call any of other `resolve` methods. (see `RuntimeArguments.swift`).
|
||||
You _should_ use this method only to resolve dependency with more runtime arguments than _Dip_ supports
|
||||
(currently it's up to six) like in this example:
|
||||
|
||||
```swift
|
||||
public func resolve<T, Arg1, Arg2, Arg3, ...>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, ...) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, ...) -> T) in factory(arg1, arg2, arg3, ...) }
|
||||
}
|
||||
```
|
||||
|
||||
Though before you do that you should probably review your design and try to reduce the number of dependencies.
|
||||
|
||||
*/
|
||||
public func resolve<T, F>(tag tag: Tag? = nil, builder: F->T) -> T {
|
||||
let key = DefinitionKey(protocolType: T.self, factoryType: F.self, associatedTag: tag)
|
||||
let nilTagKey = tag.map { _ in DefinitionKey(protocolType: T.self, factoryType: F.self, associatedTag: nil) }
|
||||
|
||||
var resolved: T!
|
||||
lockAndDo { [unowned self] in
|
||||
resolved = self._resolve(key, nilTagKey: nilTagKey, builder: builder)
|
||||
}
|
||||
return resolved
|
||||
}
|
||||
|
||||
/// Actually resolve dependency
|
||||
private func _resolve<T, F>(key: DefinitionKey, nilTagKey: DefinitionKey?, builder: F->T) -> T {
|
||||
guard let definition = (self.dependencies[key] ?? self.dependencies[nilTagKey]) as? DefinitionOf<T> else {
|
||||
fatalError("No instance factory registered with \(key) or \(nilTagKey)")
|
||||
}
|
||||
|
||||
if let resolvedInstance = definition.resolvedInstance {
|
||||
return resolvedInstance
|
||||
}
|
||||
else {
|
||||
let resolved = builder(definition.factory as! F)
|
||||
definition.resolvedInstance = resolved
|
||||
return resolved
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func lockAndDo(@noescape block: Void->Void) {
|
||||
OSSpinLockLock(&lock)
|
||||
defer { OSSpinLockUnlock(&lock) }
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
||||
extension DependencyContainer.Tag: IntegerLiteralConvertible {
|
||||
public init(integerLiteral value: IntegerLiteralType) {
|
||||
self = .Int(value)
|
||||
}
|
||||
}
|
||||
|
||||
extension DependencyContainer.Tag: StringLiteralConvertible {
|
||||
public typealias ExtendedGraphemeClusterLiteralType = StringLiteralType
|
||||
public typealias UnicodeScalarLiteralType = StringLiteralType
|
||||
|
||||
public init(stringLiteral value: StringLiteralType) {
|
||||
self = .String(value)
|
||||
}
|
||||
|
||||
public init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {
|
||||
self.init(stringLiteral: value)
|
||||
}
|
||||
|
||||
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) {
|
||||
self.init(stringLiteral: value)
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: DependencyContainer.Tag, rhs: DependencyContainer.Tag) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case let (.String(lhsString), .String(rhsString)):
|
||||
return lhsString == rhsString
|
||||
case let (.Int(lhsInt), .Int(rhsInt)):
|
||||
return lhsInt == rhsInt
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
extension Dictionary {
|
||||
subscript(key: Key?) -> Value! {
|
||||
guard let key = key else { return nil }
|
||||
return self[key]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// Dip
|
||||
//
|
||||
// Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// 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 Foundation
|
||||
|
||||
// MARK: - Register/resolve dependencies with runtime arguments
|
||||
|
||||
extension DependencyContainer {
|
||||
|
||||
// MARK: 1 Runtime Argument
|
||||
|
||||
/**
|
||||
Registers factory that accepts one runtime argument. You can use up to six runtime arguments.
|
||||
|
||||
- parameter tag: The arbitrary tag to associate this factory with when registering with that protocol.
|
||||
Pass `nil` to associate with any tag. Default value is `nil`.
|
||||
- parameter factory: The factory to register, with return type of protocol you want to register it for
|
||||
|
||||
- note: You can have several factories with different number or types of arguments registered to for same type.
|
||||
When you resolve it container will match the type and tag as well as __number__, __types__ and __order__
|
||||
of runtime arguments that you pass to `resolve` method.
|
||||
|
||||
- seealso: `register(tag:factory:scope:)`
|
||||
*/
|
||||
public func register<T, Arg1>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/**
|
||||
Resolve a dependency with runtime argument. Factories will be matched by tag and the type to resolve as well
|
||||
as __number__, __types__ and __order__ of runtime arguments that you pass to this method.
|
||||
|
||||
- parameter tag: The arbitrary tag to look for when resolving this protocol.
|
||||
- parameter arg1: First argument to be passed to factory
|
||||
|
||||
- seealso: `resolve(tag:)`
|
||||
*/
|
||||
public func resolve<T, Arg1>(tag tag: Tag? = nil, withArguments arg1: Arg1) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1) -> T) in factory(arg1) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:)` method instead.")
|
||||
public func resolve<T, Arg1>(tag tag: Tag? = nil, _ arg1: Arg1) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1) -> T) in factory(arg1) }
|
||||
}
|
||||
|
||||
// MARK: 2 Runtime Arguments
|
||||
|
||||
/// - seealso: `register(:factory:scope:)`
|
||||
public func register<T, Arg1, Arg2>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1, Arg2) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/// - seealso: `resolve(tag:_:)`
|
||||
public func resolve<T, Arg1, Arg2>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2) -> T) in factory(arg1, arg2) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:_:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:_:)` method instead.")
|
||||
public func resolve<T, Arg1, Arg2>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2) -> T) in factory(arg1, arg2) }
|
||||
}
|
||||
|
||||
// MARK: 3 Runtime Arguments
|
||||
|
||||
public func register<T, Arg1, Arg2, Arg3>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1, Arg2, Arg3) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/// - seealso: `resolve(tag:withArguments:)`
|
||||
public func resolve<T, Arg1, Arg2, Arg3>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3) -> T) in factory(arg1, arg2, arg3) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:_:_:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:_:_:)` method instead.")
|
||||
public func resolve<T, Arg1, Arg2, Arg3>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3) -> T) in factory(arg1, arg2, arg3) }
|
||||
}
|
||||
|
||||
// MARK: 4 Runtime Arguments
|
||||
|
||||
public func register<T, Arg1, Arg2, Arg3, Arg4>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1, Arg2, Arg3, Arg4) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/// - seealso: `resolve(tag:withArguments:)`
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4) -> T) in factory(arg1, arg2, arg3, arg4) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:_:_:_:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:_:_:_:)` method instead.")
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4) -> T) in factory(arg1, arg2, arg3, arg4) }
|
||||
}
|
||||
|
||||
// MARK: 5 Runtime Arguments
|
||||
|
||||
public func register<T, Arg1, Arg2, Arg3, Arg4, Arg5>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1, Arg2, Arg3, Arg4, Arg5) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/// - seealso: `resolve(tag:withArguments:)`
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5) -> T) in factory(arg1, arg2, arg3, arg4, arg5) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:_:_:_:_:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:_:_:_:_:)` method instead.")
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5) -> T) in factory(arg1, arg2, arg3, arg4, arg5) }
|
||||
}
|
||||
|
||||
// MARK: 6 Runtime Arguments
|
||||
|
||||
public func register<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(tag tag: Tag? = nil, _ scope: ComponentScope = .Prototype, factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: scope) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
/// - seealso: `resolve(tag:withArguments:)`
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> T) in factory(arg1, arg2, arg3, arg4, arg5, arg6) }
|
||||
}
|
||||
|
||||
///**Deprecated** Use `resolve(tag:withArguments:_:_:_:_:_:)` method instead.
|
||||
@available(*, deprecated, message="Use `resolve(tag:withArguments:_:_:_:_:_:)` method instead.")
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> T) in factory(arg1, arg2, arg3, arg4, arg5, arg6) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// DipTests.swift
|
||||
// DipTests
|
||||
//
|
||||
// Created by Ilya Puchka on 04.11.15.
|
||||
// Copyright © 2015 AliSoftware. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import Dip
|
||||
|
||||
protocol Service {
|
||||
func getServiceName() -> String
|
||||
}
|
||||
|
||||
class ServiceImp1: Service {
|
||||
func getServiceName() -> String {
|
||||
return "ServiceImp1"
|
||||
}
|
||||
}
|
||||
|
||||
class ServiceImp2: Service {
|
||||
func getServiceName() -> String {
|
||||
return "ServiceImp2"
|
||||
}
|
||||
}
|
||||
|
||||
class DipTests: XCTestCase {
|
||||
|
||||
let container = DependencyContainer()
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
container.reset()
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceRegisteredWithoutTag() {
|
||||
//given
|
||||
container.register { ServiceImp1() as Service }
|
||||
|
||||
//when
|
||||
let serviceInstance = container.resolve() as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(serviceInstance is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceRegisteredWithTag() {
|
||||
//given
|
||||
container.register(tag: "service") { ServiceImp1() as Service }
|
||||
|
||||
//when
|
||||
let serviceInstance = container.resolve(tag: "service") as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(serviceInstance is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesDifferentInstancesRegisteredForDifferentTags() {
|
||||
//given
|
||||
container.register(tag: "service1") { ServiceImp1() as Service }
|
||||
container.register(tag: "service2") { ServiceImp2() as Service }
|
||||
|
||||
//when
|
||||
let service1Instance = container.resolve(tag: "service1") as Service
|
||||
let service2Instance = container.resolve(tag: "service2") as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1Instance is ServiceImp1)
|
||||
XCTAssertTrue(service2Instance is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatNewRegistrationOverridesPreviousRegistration() {
|
||||
//given
|
||||
container.register { ServiceImp1() as Service }
|
||||
let service1 = container.resolve() as Service
|
||||
|
||||
//when
|
||||
container.register { ServiceImp2() as Service }
|
||||
let service2 = container.resolve() as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1 is ServiceImp1)
|
||||
XCTAssertTrue(service2 is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatItResolvesTypeAsNewInstanceEveryTime() {
|
||||
//given
|
||||
container.register { ServiceImp1() as Service }
|
||||
|
||||
//when
|
||||
let service1 = container.resolve() as Service
|
||||
let service2 = container.resolve() as Service
|
||||
|
||||
//then
|
||||
XCTAssertFalse((service1 as! ServiceImp1) === (service2 as! ServiceImp1))
|
||||
}
|
||||
|
||||
func testThatItReusesInstanceRegisteredAsSingleton() {
|
||||
//given
|
||||
container.register(.Singleton) { ServiceImp1() as Service }
|
||||
|
||||
//when
|
||||
let service1 = container.resolve() as Service
|
||||
let service2 = container.resolve() as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue((service1 as! ServiceImp1) === (service2 as! ServiceImp1))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
//
|
||||
// RuntimeArgumentsTests.swift
|
||||
// DipTests
|
||||
//
|
||||
// Created by Ilya Puchka on 04.11.15.
|
||||
// Copyright © 2015 AliSoftware. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import Dip
|
||||
|
||||
class ServiceImp3: Service {
|
||||
|
||||
let name: String
|
||||
|
||||
init(name: String, baseURL: NSURL, port: Int) {
|
||||
self.name = name
|
||||
}
|
||||
|
||||
func getServiceName() -> String {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
class RuntimeArgumentsTests: XCTestCase {
|
||||
|
||||
let container = DependencyContainer()
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
container.reset()
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithOneArgument() {
|
||||
//given
|
||||
let arg1 = 1
|
||||
container.register { (a1: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithTwoArguments() {
|
||||
//given
|
||||
let arg1 = 1, arg2 = 2
|
||||
container.register { (a1: Int, a2: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
XCTAssertEqual(a2, arg2)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1, arg2) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithThreeArguments() {
|
||||
let arg1 = 1, arg2 = 2, arg3 = 3
|
||||
container.register { (a1: Int, a2: Int, a3: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
XCTAssertEqual(a2, arg2)
|
||||
XCTAssertEqual(a3, arg3)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1, arg2, arg3) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithFourArguments() {
|
||||
let arg1 = 1, arg2 = 2, arg3 = 3, arg4 = 4
|
||||
container.register { (a1: Int, a2: Int, a3: Int, a4: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
XCTAssertEqual(a2, arg2)
|
||||
XCTAssertEqual(a3, arg3)
|
||||
XCTAssertEqual(a4, arg4)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1, arg2, arg3, arg4) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithFiveArguments() {
|
||||
let arg1 = 1, arg2 = 2, arg3 = 3, arg4 = 4, arg5 = 5
|
||||
container.register { (a1: Int, a2: Int, a3: Int, a4: Int, a5: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
XCTAssertEqual(a2, arg2)
|
||||
XCTAssertEqual(a3, arg3)
|
||||
XCTAssertEqual(a4, arg4)
|
||||
XCTAssertEqual(a5, arg5)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1, arg2, arg3, arg4, arg5) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItResolvesInstanceWithSixArguments() {
|
||||
let arg1 = 1, arg2 = 2, arg3 = 3, arg4 = 4, arg5 = 5, arg6 = 6
|
||||
container.register { (a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int) -> Service in
|
||||
XCTAssertEqual(a1, arg1)
|
||||
XCTAssertEqual(a2, arg2)
|
||||
XCTAssertEqual(a3, arg3)
|
||||
XCTAssertEqual(a4, arg4)
|
||||
XCTAssertEqual(a5, arg5)
|
||||
XCTAssertEqual(a6, arg6)
|
||||
return ServiceImp1()
|
||||
}
|
||||
|
||||
//when
|
||||
let service = container.resolve(withArguments: arg1, arg2, arg3, arg4, arg5, arg6) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service is ServiceImp1)
|
||||
}
|
||||
|
||||
func testThatItRegistersDifferentFactoriesForDifferentNumberOfArguments() {
|
||||
//given
|
||||
let arg1 = 1, arg2 = 2
|
||||
container.register { (a1: Int) in ServiceImp1() as Service }
|
||||
container.register { (a1: Int, a2: Int) in ServiceImp2() as Service }
|
||||
|
||||
//when
|
||||
let service1 = container.resolve(withArguments: arg1) as Service
|
||||
let service2 = container.resolve(withArguments: arg1, arg2) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1 is ServiceImp1)
|
||||
XCTAssertTrue(service2 is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatItRegistersDifferentFactoriesForDifferentTypesOfArguments() {
|
||||
//given
|
||||
let arg1 = 1, arg2 = "string"
|
||||
container.register { (a1: Int) in ServiceImp1() as Service }
|
||||
container.register { (a1: String) in ServiceImp2() as Service }
|
||||
|
||||
//when
|
||||
let service1 = container.resolve(withArguments: arg1) as Service
|
||||
let service2 = container.resolve(withArguments: arg2) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1 is ServiceImp1)
|
||||
XCTAssertTrue(service2 is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatItRegistersDifferentFactoriesForDifferentOrderOfArguments() {
|
||||
//given
|
||||
let arg1 = 1, arg2 = "string"
|
||||
container.register { (a1: Int, a2: String) in ServiceImp1() as Service }
|
||||
container.register { (a1: String, a2: Int) in ServiceImp2() as Service }
|
||||
|
||||
//when
|
||||
let service1 = container.resolve(withArguments: arg1, arg2) as Service
|
||||
let service2 = container.resolve(withArguments: arg2, arg1) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1 is ServiceImp1)
|
||||
XCTAssertTrue(service2 is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatNewRegistrationWithSameArgumentsOverridesPreviousRegistration() {
|
||||
//given
|
||||
let arg1 = 1, arg2 = 2
|
||||
container.register { (a1: Int, a2: Int) in ServiceImp1() as Service }
|
||||
let service1 = container.resolve(withArguments: arg1, arg2) as Service
|
||||
|
||||
//when
|
||||
container.register { (a1: Int, a2: Int) in ServiceImp2() as Service }
|
||||
let service2 = container.resolve(withArguments: arg1, arg2) as Service
|
||||
|
||||
//then
|
||||
XCTAssertTrue(service1 is ServiceImp1)
|
||||
XCTAssertTrue(service2 is ServiceImp2)
|
||||
}
|
||||
|
||||
func testThatDifferentFactoriesRegisteredIfArgumentIsOptional() {
|
||||
//given
|
||||
let name1 = "1", name2 = "2", name3 = "3"
|
||||
container.register { (port: Int, url: NSURL) in ServiceImp3(name: name1, baseURL: url, port: port) as Service }
|
||||
container.register { (port: Int, url: NSURL?) in ServiceImp3(name: name2, baseURL: url!, port: port) as Service }
|
||||
container.register { (port: Int, url: NSURL!) in ServiceImp3(name: name3, baseURL: url, port: port) as Service }
|
||||
|
||||
//when
|
||||
let url: NSURL = NSURL(string: "http://example.com")!
|
||||
let service1 = container.resolve(withArguments: 80, url) as Service
|
||||
let service2 = container.resolve(withArguments: 80, NSURL(string: "http://example.com")) as Service
|
||||
|
||||
let service3 = container.resolve(withArguments: 80, NSURL(string: "http://example.com")! as NSURL!) as Service
|
||||
let service4 = container.resolve(withArguments: 80, NSURL(string: "http://example.com")!) as Service
|
||||
|
||||
//then
|
||||
XCTAssertEqual(service1.getServiceName(), name1)
|
||||
XCTAssertEqual(service2.getServiceName(), name2)
|
||||
XCTAssertEqual(service3.getServiceName(), name3)
|
||||
XCTAssertEqual(service4.getServiceName(), name1) //implicitly unwrapped optional parameter is the same as not optional parameter
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//: [Previous: What is Dip?](@previous)
|
||||
|
||||
import Dip
|
||||
|
||||
/*:
|
||||
Dip has two base components: a _DependencyContainer_ and its _Definitions_.
|
||||
|
||||
- _DependencyContainer_ is used to register _Definitions_ and to resolve them.
|
||||
- _Definitions_ describe how component should be created by the _DependencyContainer_.
|
||||
|
||||
### Creating the container
|
||||
|
||||
You can create a container using a simple `init()`:
|
||||
*/
|
||||
|
||||
var container = DependencyContainer()
|
||||
//register components here
|
||||
|
||||
/*:
|
||||
or using a configuration block:
|
||||
*/
|
||||
|
||||
container = DependencyContainer { container in
|
||||
//register components here
|
||||
}
|
||||
|
||||
/*:
|
||||
Both syntaxes are equivalent. The one using the configuration block is simply a convenience way to scope your components registrations in a nice looking way.
|
||||
|
||||
### When/where to create container?
|
||||
|
||||
While there is an option to use container as a global variable we advise instead to create and configure container in your app delegate and pass it between your objects.
|
||||
|
||||
*/
|
||||
//: [Next: Registering Components](@next)
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,44 @@
|
||||
//: [Previous: Creating a DependencyContainer](@previous)
|
||||
|
||||
import Dip
|
||||
|
||||
/*:
|
||||
|
||||
### Registering components
|
||||
|
||||
You register a definition in a container using the `register` method:
|
||||
*/
|
||||
let container = DependencyContainer()
|
||||
container.register { ServiceImp1() as Service }
|
||||
|
||||
/*:
|
||||
That code means that when you need a `Service`, you want to use instances of `ServiceImp1` class created with it's `init()` initializer.
|
||||
|
||||
You can also register factories that accept runtime arguments:
|
||||
*/
|
||||
|
||||
container.register { service in ClientImp1(service: service) as Client }
|
||||
|
||||
/*:
|
||||
Dip supports up to six runtime arguments, but you can use as many as you want. For more details see ["Runtime arguments"](Runtime%20arguments).
|
||||
|
||||
You can also use factory methods in definitions. This can be useful if you already have some factories but want to migrate to Dip.
|
||||
*/
|
||||
|
||||
let factory = ServiceFactory()
|
||||
// factory.someService is a method with signature `() -> Service`, Cmd-Click to see definition
|
||||
container.register(factory: factory.someService)
|
||||
|
||||
/*:
|
||||
Optionally you can associate definitions with Integer or String tags. This way you can register different implementations for the same protocol.
|
||||
You can use String or Integer literals, or the `DependencyContainer.Tag` enum.
|
||||
*/
|
||||
|
||||
container.register(tag: "tag") { ServiceImp1() as Service }
|
||||
container.register(tag: DependencyContainer.Tag.Int(0)) { ServiceImp1() as Service }
|
||||
|
||||
/*:
|
||||
We recommand you to use constants for the tags, to make the intent clear and avoid magic numbers and typos.
|
||||
*/
|
||||
|
||||
//: [Next: Resolving Components](@next)
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,47 @@
|
||||
//: [Previous: Registering Components](@previous)
|
||||
|
||||
import Dip
|
||||
let container = DependencyContainer { container in
|
||||
container.register { ServiceImp1() as Service }
|
||||
}
|
||||
|
||||
/*:
|
||||
|
||||
### Resolving components
|
||||
|
||||
You resolve previously registered definition using `resolve` method:
|
||||
*/
|
||||
|
||||
var service = container.resolve() as Service
|
||||
|
||||
/*:
|
||||
That code says that you want your `container` to give you an instance that was registered as implementation of `Service` protocol.
|
||||
|
||||
It's important to specify the same type that you used for registration. You can use either `as` syntax, or specify type of you variable when you define it:
|
||||
*/
|
||||
|
||||
let otherService: Service = container.resolve()
|
||||
|
||||
/*:
|
||||
Both ways will let the `container` detect the type that you want to resolve as. We prefer the `as` syntax because it reads more naturally in Swift.
|
||||
|
||||
If you used a tag to register your component, you can use the same tag to resolve it. If there is no definition with such tag, the `container` will try to find a definition for the same type with no tag (`nil` tag), and resolve it instead, allowing you to provide default components in such cases.
|
||||
*/
|
||||
|
||||
container.register(tag: "production") { ServiceImp1() as Service }
|
||||
container.register(tag: "test") { ServiceImp2() as Service }
|
||||
|
||||
// Will give you a ServiceImp1 instance
|
||||
let productionService = container.resolve(tag: "production") as Service
|
||||
// Will give you a ServiceImp2 instance
|
||||
let testService = container.resolve(tag: "test") as Service
|
||||
// Will give you a ServiceImp1 because one was registered without a tag on line 4
|
||||
let defaultService = container.resolve() as Service
|
||||
|
||||
/*:
|
||||
You can use runtime arguments to resolve components. Dip supports up to six arguments. For more details see ["Runtime arguments"](Runtime%20arguments).
|
||||
*/
|
||||
container.register { service in ClientImp1(service: service) as Client }
|
||||
let client = container.resolve(service) as Client
|
||||
|
||||
//: [Next: Runtime Arguments](@next)
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,51 @@
|
||||
//: [Previous: Resolving Components](@previous)
|
||||
|
||||
import Dip
|
||||
|
||||
let container = DependencyContainer()
|
||||
|
||||
/*:
|
||||
|
||||
### Runtime arguments
|
||||
|
||||
Dip lets you use runtime arguments to register and resolve your components.
|
||||
Note that __types__, __number__ and __order__ of arguments matters and you can register different factories with different set of runtime arguments for the same protocol. To resolve using one of this factory you will need to pass runtime arguments of the same types, number and in the same order to `resolve` as you used in `register` method.
|
||||
*/
|
||||
|
||||
container.register { (url: NSURL, port: Int) in ServiceImp3(name: "1", baseURL: url, port: port) as Service }
|
||||
container.register { (port: Int, url: NSURL) in ServiceImp3(name: "2", baseURL: url, port: port) as Service }
|
||||
container.register { (port: Int, url: NSURL?) in ServiceImp3(name: "3", baseURL: url!, port: port) as Service }
|
||||
container.register { (port: Int, url: NSURL!) in ServiceImp3(name: "4", baseURL: url, port: port) as Service }
|
||||
|
||||
let url: NSURL = NSURL(string: "http://example.com")!
|
||||
let service1 = container.resolve(withArguments: url, 80) as Service
|
||||
let service2 = container.resolve(withArguments: 80, url) as Service
|
||||
let service3 = container.resolve(withArguments: 80, NSURL(string: "http://example.com")) as Service
|
||||
let service4 = container.resolve(withArguments: 80, NSURL(string: "http://example.com")! as NSURL!) as Service
|
||||
|
||||
(service1 as! ServiceImp3).name
|
||||
(service2 as! ServiceImp3).name
|
||||
(service3 as! ServiceImp3).name
|
||||
(service4 as! ServiceImp3).name
|
||||
|
||||
/*:
|
||||
Note that all of the services were resolved using different factories.
|
||||
|
||||
_Dip_ supports up to six runtime arguments. If that is not enougth you can extend `DependencyContainer` to accept more arguments. For example, here is how you can extend it to serve seven arguments.
|
||||
*/
|
||||
|
||||
extension DependencyContainer {
|
||||
public func register<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(tag tag: Tag? = nil, factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> T) -> DefinitionOf<T> {
|
||||
return register(tag: tag, factory: factory, scope: .Prototype) as DefinitionOf<T>
|
||||
}
|
||||
|
||||
public func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>(tag tag: Tag? = nil, _ arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6) -> T {
|
||||
return resolve(tag: tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) -> T) in factory(arg1, arg2, arg3, arg4, arg5, arg6) }
|
||||
}
|
||||
}
|
||||
|
||||
/*:
|
||||
However, if you find yourself thinking about adding more runtime arguments, stop and think about your design instead. Having too many dependencies could be a sign of some problem in your architecture, so we strongly suggest that you refrain from doing so; six runtime arguments is already a lot.
|
||||
*/
|
||||
|
||||
//: [Next: Scopes](@next)
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,31 @@
|
||||
//: [Previous: Runtime Arguments](@previous)
|
||||
|
||||
import Dip
|
||||
|
||||
/*:
|
||||
|
||||
### Scopes
|
||||
|
||||
Dip supports two different scopes of objects: _Prototype_ and _Singleton_.
|
||||
|
||||
* The `.Prototype` scope will make the `DependencyContainer` resolve your type as __a new instance every time__ you call `resolve`.
|
||||
* The `.Singleton` scope will make the `DependencyContainer` retain the instance once resolved the first time, and reuse it in the next calls during the container lifetime.
|
||||
|
||||
The `.Prototype` scope is the default. To register a singleton, use `register(tag:instance:)`
|
||||
*/
|
||||
|
||||
let container = DependencyContainer { container in
|
||||
container.register(tag:"sharedService", instance: ServiceImp1() as Service)
|
||||
container.register { ServiceImp1() as Service }
|
||||
}
|
||||
|
||||
let sharedService = container.resolve(tag: "sharedService") as Service
|
||||
let sameSharedService = container.resolve(tag: "sharedService") as Service
|
||||
sharedService as! ServiceImp1 === sameSharedService as! ServiceImp1
|
||||
|
||||
let service = container.resolve() as Service
|
||||
let anotherService = container.resolve() as Service
|
||||
service as! ServiceImp1 === anotherService as! ServiceImp1
|
||||
|
||||
//: [Next: Shared Instances](@next)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,159 @@
|
||||
//: [Previous: Scopes](@previous)
|
||||
|
||||
import Dip
|
||||
import UIKit
|
||||
|
||||
/*:
|
||||
### Shared Instances
|
||||
|
||||
The Singleton pattern is probably the most debatable and abused pattern in Cocoa development (and probably in programming in general). It's probably the first thing that you will hear from a candidate developer on interview when you ask about Cocoa patterns (the other one will be a delegate).
|
||||
|
||||
The problem with singleton is not that it's a worst pattern. The problem is that developers use it to solve problems that do not require it at all. Another problem is that it's very easy to be tempted by this pattern cause it's very easy to implement and use - import file and call `sharedInstance`. But that leads to all kinds of problems:
|
||||
|
||||
- First - singleton is a shared mutable state. And the worst thing is that it's a _mutable_ state.
|
||||
- Second - singleton tigthly couple components of your system.
|
||||
- Third - it limits your code flexibility.
|
||||
|
||||
Dip supports singletons, but it reduces cost of using them. Their singleton nature is managed by the _Container_ and defined only by the _Definitions_ that you register, not by concrete implementations of your classes.
|
||||
|
||||
- No need for calls to `sharedInstance` in your code anymore. Instead you get the instance from the _Container_ by resolving a protocol.
|
||||
- You can easyly change concrete implementations without the rest of your system even notice that something changed.
|
||||
- Also it's easy to test - you just register another object in your tests. Even if you still want to use a singleton in your system.
|
||||
|
||||
Probably the most common example is using a singleton in the network layer or "API client".
|
||||
*/
|
||||
|
||||
class ApiClientSingleton {
|
||||
static let sharedInstance = ApiClientSingleton()
|
||||
private init() {}
|
||||
// Typically a method that makes a GET request on your API
|
||||
func get(path: String, completion:()->()) {}
|
||||
}
|
||||
|
||||
class MyViewControllerWithSingleton: UIViewController {
|
||||
override func viewDidAppear(amimated: Bool) {
|
||||
super.viewDidAppear(amimated)
|
||||
ApiClientSingleton.sharedInstance.get("/users") { /* refresh your UI */ }
|
||||
}
|
||||
}
|
||||
|
||||
/*:
|
||||
Sure, this is very easy to code indeed. And nothing bad so far.
|
||||
|
||||
But probably if you wrote a unit test or integration test for that code first, you would have noticed a problem earilier. How you test that code? And how you ensure that your tests are idenpendent of the API client's state from the previous test?
|
||||
Of cource you can work around all of the problems and the fact that `ApiClient` is a singleton, reset it's state somehow, or mock a class so that it will not return a singleton instance. But look - a moment before the singleton was your best friend and now you are fighting against it.
|
||||
|
||||
Think - why do you want API client to be a singleton in a first place? To queue or throttle requests? Then do your queue or throttler a singleton, not an API client. Or is there any other reason. Most likely API client itself does not have a requirement to have only one system during the whole lifecycle of your application. Imagine that in the future we need two API Clients, because you now have to address two different servers & plaforms? Imposing that singleton restricts now your flexibility a lot.
|
||||
|
||||
Instead, inject API client in view controller with property injection or constructor injection.
|
||||
*/
|
||||
|
||||
protocol ApiClientProtocol {
|
||||
func get(path: String, completion:()->())
|
||||
}
|
||||
|
||||
class ApiClient: ApiClientProtocol {
|
||||
|
||||
private struct ApiScheduler {
|
||||
/* … */
|
||||
}
|
||||
|
||||
private let scheduler = ApiScheduler()
|
||||
|
||||
init(){}
|
||||
|
||||
func get(path: String, completion:()->()) {}
|
||||
}
|
||||
|
||||
class MyViewController: UIViewController {
|
||||
var apiClient: ApiClientProtocol!
|
||||
|
||||
override func viewDidAppear(amimated: Bool) {
|
||||
super.viewDidAppear(amimated)
|
||||
apiClient.get("path") {}
|
||||
}
|
||||
|
||||
convenience init(apiClient: ApiClientProtocol) {
|
||||
self.init()
|
||||
self.apiClient = apiClient
|
||||
}
|
||||
|
||||
init() {
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
//inject with constructor
|
||||
let viewController = MyViewController(apiClient: ApiClient())
|
||||
//or with property
|
||||
viewController.apiClient = ApiClient()
|
||||
|
||||
/*:
|
||||
With Dip this code can look like this:
|
||||
*/
|
||||
|
||||
let container = DependencyContainer { container in
|
||||
container.register { ApiClient() as ApiClientProtocol }
|
||||
}
|
||||
|
||||
class DipViewController: UIViewController {
|
||||
var apiClient: ApiClientProtocol!
|
||||
|
||||
override func viewDidAppear(amimated: Bool) {
|
||||
super.viewDidAppear(amimated)
|
||||
apiClient.get("path") {}
|
||||
}
|
||||
|
||||
convenience init(dependencies: DependencyContainer) {
|
||||
self.init()
|
||||
self.apiClient = dependencies.resolve() as ApiClientProtocol
|
||||
}
|
||||
|
||||
init() {
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
|
||||
var dipController = DipViewController(dependencies: container)
|
||||
|
||||
/*:
|
||||
Of cource `DependencyContainer` should not be used as singleton too. Instead, inject it to objects that need to access it. And use a protocol for that. For example if your view controller needs to access API client, it does not need a reference to `DependencyContainer`, it only needs a reference to _something_ that can provide it an API client instance.
|
||||
*/
|
||||
|
||||
protocol ApiClientProvider {
|
||||
func apiClient() -> ApiClientProtocol
|
||||
}
|
||||
|
||||
extension DependencyContainer: ApiClientProvider {
|
||||
func apiClient() -> ApiClientProtocol {
|
||||
return self.resolve() as ApiClientProtocol
|
||||
}
|
||||
}
|
||||
|
||||
extension DipViewController {
|
||||
convenience init(apiClientProvider: ApiClientProvider) {
|
||||
self.init()
|
||||
self.apiClient = apiClientProvider.apiClient()
|
||||
}
|
||||
}
|
||||
|
||||
dipController = DipViewController(apiClientProvider: container)
|
||||
|
||||
/*:
|
||||
This way you also does not depend directly on Dip. Instead you provide a boundary between Dip — that you don't have control of — and your source code. So when something chagnes in Dip, you update only the boundary code.
|
||||
|
||||
Dependency injection is a pattern as well as singleton. And any pattern can be abused. That's why if you adopt DI in one part of your system it does not mean that you should inject everything and everywhere. The same with using protocols instead of concrete implementations. For every tool there is a right time and the same way as singleton can harm you the same way DI and protocols abuse can make your code unnececerry complex.
|
||||
|
||||
*/
|
||||
|
||||
//: [Next: Testing](@next)
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,70 @@
|
||||
//: [Previous: Shared Instances](@previous)
|
||||
|
||||
|
||||
/*:
|
||||
|
||||
### Testing
|
||||
|
||||
Dip is convenient to use for testing. Here is s simple example of how you can write tests with Dip.
|
||||
|
||||
__Note__: That's a very simple example just to demostrate use of Dip in tests, not how you should or should not tests your code in general.
|
||||
You can learn more about testing based on state verification vs behavior verification [here](http://martinfowler.com/articles/mocksArentStubs.html).
|
||||
|
||||
*/
|
||||
|
||||
protocol Service {
|
||||
func doSomething()
|
||||
}
|
||||
|
||||
class Client {
|
||||
var service: Service!
|
||||
|
||||
func callService() {
|
||||
service.doSomething()
|
||||
}
|
||||
}
|
||||
|
||||
import XCTest
|
||||
import Dip
|
||||
|
||||
/*:
|
||||
Instead of the real `Service` implementation, provide a _fake_ implementation with test hooks that you need:
|
||||
*/
|
||||
|
||||
class FakeService: Service {
|
||||
var doSomethingCalled = false
|
||||
|
||||
func doSomething() {
|
||||
doSomethingCalled = true
|
||||
}
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
class MyTests: XCTestCase {
|
||||
var container: DependencyContainer!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
/*:
|
||||
Register fake implementation as `Service`:
|
||||
*/
|
||||
container = DependencyContainer { container in
|
||||
container.register { FakeService() as Service }
|
||||
}
|
||||
}
|
||||
|
||||
func testThatDoSomethingIsCalled() {
|
||||
let sut = Client()
|
||||
sut.service = container.resolve() as Service
|
||||
|
||||
sut.callService()
|
||||
|
||||
/*:
|
||||
And finally you test it was called:
|
||||
*/
|
||||
XCTAssertTrue((sut.service as! FakeService).doSomethingCalled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,21 @@
|
||||
/*:
|
||||
__Note__: _This playground needs to be open as part of the `Dip.xcworkspace` so it can import the Dip framework / module and demonstrate its usage. (The playground won't work properly if you open it on its own)._
|
||||
|
||||
_You might also need to ask Xcode to build the Dip framework first (Command-B) before it can find and import it in this playground._
|
||||
*/
|
||||
|
||||
/*:
|
||||
## What is Dip?
|
||||
|
||||
_Dip_ is a lightweight Swift implementation of [IoC container](https://en.wikipedia.org/wiki/Inversion_of_control).
|
||||
|
||||
If you follow [Protocol-Oriented programming](https://developer.apple.com/videos/play/wwdc2015-408/) or [SOLID principles](http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod) then instead of concrete classes you should use protocols to define dependencies between components of your system. I.e. if you need to access some network API, you should use instances of an `APIClient` protocol instead of instances of a concrete class `APIClientImp`.
|
||||
|
||||
[Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection) is a good tool to leverage Protocol-Oriented or SOLID design. Using this principle, you move the point where you create concrete instances _from inside objects_ that use them, _to higher levels_ of your system. **Now your objects do not depend on concrete implementations of their dependencies**, they depend **only on their public interfaces**, defined by protocols that they implement. That gives you all sorts of advantages from **easier testability** to **greater flexibility** of your system.
|
||||
|
||||
But still there should be some point in your program where concrete instances are created. The thing is that it's better to have one well defined point for that than to scatter setup logic all over the place with different factories and lazy properties. IoC containers like _Dip_ play the role of that point.
|
||||
|
||||
The following pages in this Playground demonstrates how to use _Dip_ to adopt all those concepts in practice.
|
||||
*/
|
||||
//: [Next: Creating a DependencyContainer](@next)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Timeline
|
||||
version = "3.0">
|
||||
<TimelineItems>
|
||||
</TimelineItems>
|
||||
</Timeline>
|
||||
@@ -0,0 +1,47 @@
|
||||
import Foundation
|
||||
|
||||
public protocol Service {}
|
||||
|
||||
public class ServiceImp1: Service {
|
||||
public init() {}
|
||||
}
|
||||
public class ServiceImp2: Service {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public class ServiceImp3: Service {
|
||||
|
||||
public let name: String
|
||||
|
||||
public init(name: String, baseURL: NSURL, port: Int) {
|
||||
self.name = name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public protocol Client {
|
||||
var service: Service {get}
|
||||
init(service: Service)
|
||||
}
|
||||
public class ClientImp1: Client {
|
||||
public var service: Service
|
||||
public required init(service: Service) {
|
||||
self.service = service
|
||||
}
|
||||
}
|
||||
|
||||
public class ClientImp2: Client {
|
||||
public var service: Service
|
||||
public required init(service: Service) {
|
||||
self.service = service
|
||||
}
|
||||
}
|
||||
|
||||
public class ServiceFactory {
|
||||
public init() {}
|
||||
|
||||
public func someService() -> Service {
|
||||
return ServiceImp1()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='6.0' target-platform='ios' display-mode='rendered'>
|
||||
<pages>
|
||||
<page name='What is Dip?'/>
|
||||
<page name='Creating container'/>
|
||||
<page name='Registering components'/>
|
||||
<page name='Resolving components'/>
|
||||
<page name='Runtime arguments'/>
|
||||
<page name='Scopes'/>
|
||||
<page name='Shared Instances'/>
|
||||
<page name='Testing'/>
|
||||
</pages>
|
||||
</playground>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
</Workspace>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Dip.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,12 +0,0 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
use_frameworks!
|
||||
platform :ios, '8.0'
|
||||
|
||||
target 'DipSampleApp' do
|
||||
pod 'Dip', :path => '../'
|
||||
end
|
||||
|
||||
target 'DipTests' do
|
||||
pod "Dip", :path => '../'
|
||||
end
|
||||
@@ -1,14 +0,0 @@
|
||||
PODS:
|
||||
- Dip (2.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Dip (from `../`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Dip:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Dip: ae784a32e584d5c57809b2cdc4fd2f287d075f7a
|
||||
|
||||
COCOAPODS: 0.39.0
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "Dip",
|
||||
"version": "2.0.0",
|
||||
"summary": "A simple Dependency Resolver: Dependency Injection using Protocol resolution.",
|
||||
"description": "Dip is a Swift framework to manage your Dependencies between your classes\nin your app using Dependency Injection.\n\nIt's aimed to be very simple to use while improving testability\nof your app by allowing you to get rid of those sharedInstances and instead\ninject values based on protocol resolution.\n\nDefine your API using a protocol, then ask Dip to resolve this protocol into\nan instance dynamically in your classes. Then your App and your Tests can be\nconfigured to resolve the protocol using a different instance or class so this\nimprove testability by decoupling the API and the concrete class used to implement it.",
|
||||
"homepage": "https://github.com/AliSoftware/Dip",
|
||||
"license": "MIT",
|
||||
"authors": {
|
||||
"Olivier Halligon": "olivier@halligon.net"
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/AliSoftware/Dip.git",
|
||||
"tag": "2.0.0"
|
||||
},
|
||||
"social_media_url": "https://twitter.com/aligatr",
|
||||
"platforms": {
|
||||
"ios": "8.0"
|
||||
},
|
||||
"requires_arc": true,
|
||||
"source_files": "Sources/**/*"
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
PODS:
|
||||
- Dip (2.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Dip (from `../`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Dip:
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Dip: ae784a32e584d5c57809b2cdc4fd2f287d075f7a
|
||||
|
||||
COCOAPODS: 0.39.0
|
||||
@@ -1,671 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
233F81BF5C5FCE081EE3E4963D0B28CD /* Pods-DipSampleApp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DC6F865EBD27FE4416E8655E73F7426 /* Pods-DipSampleApp-dummy.m */; };
|
||||
3E5EF2244E6759BDB00BF6F862FFAD43 /* Dip-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 98D1A0DC92D3A4A2B32D1B6094DECDA3 /* Dip-dummy.m */; };
|
||||
598949CC3DD0DD2142DFA9759D331DB6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; };
|
||||
73DFA9D2D6721ED2BF48E815083FC935 /* Dip.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1855646D8AC0B232E538D845A7894FF /* Dip.swift */; };
|
||||
774AC175C524A1E16D01BB9CF19651ED /* Pods-DipTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FDAF80E63D5379C5D67B2C5D37CB44 /* Pods-DipTests-dummy.m */; };
|
||||
8FB62E6448665FAB1B4B40278A9C18B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; };
|
||||
92915F15583230B1CF7E9FAB6FFD5817 /* Dip-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F68496928C5CF49172AFF11B37314C7 /* Dip-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
CE06FE77C65C0BE8BDD6AFB33EAD328F /* Pods-DipSampleApp-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = ACEDE7C6DC726F30DC3F36A7ECD7A8C2 /* Pods-DipSampleApp-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
DF187AAE55CEA68761E21B080E2C2CF2 /* Pods-DipTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 88B21BAF0A10E4BCDFF1F69039F04287 /* Pods-DipTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
F8D681A620B7540C44E9B51BD381C514 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
62848E69B71441AB05941E7E2F09E1D8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 28230D259635091F92F106AA282AA138;
|
||||
remoteInfo = Dip;
|
||||
};
|
||||
F9BC91C90262AF7A128076332A48985F /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 28230D259635091F92F106AA282AA138;
|
||||
remoteInfo = Dip;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
040E6767354650F6353098E4EB50B3F7 /* Pods-DipSampleApp.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-DipSampleApp.modulemap"; sourceTree = "<group>"; };
|
||||
08FDAF80E63D5379C5D67B2C5D37CB44 /* Pods-DipTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-DipTests-dummy.m"; sourceTree = "<group>"; };
|
||||
093DB70F67DB4E609AB442CBB509D4E7 /* Pods-DipTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DipTests-resources.sh"; sourceTree = "<group>"; };
|
||||
2F6C88DA4612709E46E6E64B8DE3DF7B /* Pods-DipTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DipTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3BFEC463C4346DFBB40CFD331E7B8C8C /* Pods-DipSampleApp-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-DipSampleApp-acknowledgements.plist"; sourceTree = "<group>"; };
|
||||
3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
4AC7412F56C556428F0902BDB2B9CC74 /* Pods-DipSampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DipSampleApp.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
4D03528B91AE7D78A28CE55BADFA6159 /* Pods-DipTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-DipTests-acknowledgements.plist"; sourceTree = "<group>"; };
|
||||
53E603F956BC0848C3DC16E858DAA805 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
551D96FB45D8D47702C68C545344BB55 /* Dip-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Dip-prefix.pch"; sourceTree = "<group>"; };
|
||||
6418C112ABDD19D3EF1DD98DB3019F05 /* Pods_DipTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DipTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6DC6F865EBD27FE4416E8655E73F7426 /* Pods-DipSampleApp-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-DipSampleApp-dummy.m"; sourceTree = "<group>"; };
|
||||
88B21BAF0A10E4BCDFF1F69039F04287 /* Pods-DipTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-DipTests-umbrella.h"; sourceTree = "<group>"; };
|
||||
8A5334FC48EF0DBABDE182FB6C1E6C3D /* Pods_DipSampleApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DipSampleApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
98D1A0DC92D3A4A2B32D1B6094DECDA3 /* Dip-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Dip-dummy.m"; sourceTree = "<group>"; };
|
||||
9F68496928C5CF49172AFF11B37314C7 /* Dip-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Dip-umbrella.h"; sourceTree = "<group>"; };
|
||||
A37235974396D8B3A4A2163B9FAF0328 /* Pods-DipSampleApp-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DipSampleApp-resources.sh"; sourceTree = "<group>"; };
|
||||
ACEDE7C6DC726F30DC3F36A7ECD7A8C2 /* Pods-DipSampleApp-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-DipSampleApp-umbrella.h"; sourceTree = "<group>"; };
|
||||
AF0EA8CE3EB9D052ABA91BBDF5935932 /* Pods-DipSampleApp-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DipSampleApp-frameworks.sh"; sourceTree = "<group>"; };
|
||||
B13AB9998F2CB1AA813B9AB7A6851FBA /* Pods-DipTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DipTests-frameworks.sh"; sourceTree = "<group>"; };
|
||||
BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
|
||||
BDD421F6E0B38080BCB472073DA141EF /* Dip.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Dip.modulemap; sourceTree = "<group>"; };
|
||||
C9D3BEDF370AEED8CE8D3838C4F8BCB1 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
D1855646D8AC0B232E538D845A7894FF /* Dip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Dip.swift; sourceTree = "<group>"; };
|
||||
D431A88F8543B8C4079050ACDD792D51 /* Dip.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Dip.xcconfig; sourceTree = "<group>"; };
|
||||
D70F3F84928AF07F304E2A78BED54F5E /* Pods-DipTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DipTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
DD7CF98DF0A99296E41AF2D9C3B473F9 /* Pods-DipTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-DipTests-acknowledgements.markdown"; sourceTree = "<group>"; };
|
||||
DDDDDD06DF5540C55DA4B0C74E1EC511 /* Pods-DipTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-DipTests.modulemap"; sourceTree = "<group>"; };
|
||||
E1A14DC75595E6F6652CBCCE34EF2BC2 /* Dip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Dip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E2C25F36DD7F27E8BA0BDFFF808541A7 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F5067212B9AFB98F7CCBC7151A60A220 /* Pods-DipSampleApp-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-DipSampleApp-acknowledgements.markdown"; sourceTree = "<group>"; };
|
||||
FCA73F622E211B8366C7D190CE804EA5 /* Pods-DipSampleApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DipSampleApp.release.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
7054D0CB6C690B6BE41E609084CA0958 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8FB62E6448665FAB1B4B40278A9C18B3 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9E15208AD5F4351018028853ABA69EB9 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F8D681A620B7540C44E9B51BD381C514 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
ED999B179D5C9983F80D581113B9D018 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
598949CC3DD0DD2142DFA9759D331DB6 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
02DBDCD39FB1D88711D499C4EE8EE355 /* Pods-DipTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
53E603F956BC0848C3DC16E858DAA805 /* Info.plist */,
|
||||
DDDDDD06DF5540C55DA4B0C74E1EC511 /* Pods-DipTests.modulemap */,
|
||||
DD7CF98DF0A99296E41AF2D9C3B473F9 /* Pods-DipTests-acknowledgements.markdown */,
|
||||
4D03528B91AE7D78A28CE55BADFA6159 /* Pods-DipTests-acknowledgements.plist */,
|
||||
08FDAF80E63D5379C5D67B2C5D37CB44 /* Pods-DipTests-dummy.m */,
|
||||
B13AB9998F2CB1AA813B9AB7A6851FBA /* Pods-DipTests-frameworks.sh */,
|
||||
093DB70F67DB4E609AB442CBB509D4E7 /* Pods-DipTests-resources.sh */,
|
||||
88B21BAF0A10E4BCDFF1F69039F04287 /* Pods-DipTests-umbrella.h */,
|
||||
2F6C88DA4612709E46E6E64B8DE3DF7B /* Pods-DipTests.debug.xcconfig */,
|
||||
D70F3F84928AF07F304E2A78BED54F5E /* Pods-DipTests.release.xcconfig */,
|
||||
);
|
||||
name = "Pods-DipTests";
|
||||
path = "Target Support Files/Pods-DipTests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3A648B4C2102C68BD49258688BF389CC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E1A14DC75595E6F6652CBCCE34EF2BC2 /* Dip.framework */,
|
||||
8A5334FC48EF0DBABDE182FB6C1E6C3D /* Pods_DipSampleApp.framework */,
|
||||
6418C112ABDD19D3EF1DD98DB3019F05 /* Pods_DipTests.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
46E7572EB1611944AB13E50F656187E9 /* Development Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C40734A4DEEFC0C72EE1D1BCF19DD769 /* Dip */,
|
||||
);
|
||||
name = "Development Pods";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
480A2A3476910EE7306AD0610F482D25 /* Support Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BDD421F6E0B38080BCB472073DA141EF /* Dip.modulemap */,
|
||||
D431A88F8543B8C4079050ACDD792D51 /* Dip.xcconfig */,
|
||||
98D1A0DC92D3A4A2B32D1B6094DECDA3 /* Dip-dummy.m */,
|
||||
551D96FB45D8D47702C68C545344BB55 /* Dip-prefix.pch */,
|
||||
9F68496928C5CF49172AFF11B37314C7 /* Dip-umbrella.h */,
|
||||
C9D3BEDF370AEED8CE8D3838C4F8BCB1 /* Info.plist */,
|
||||
);
|
||||
name = "Support Files";
|
||||
path = "Example/Pods/Target Support Files/Dip";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7DB346D0F39D3F0E887471402A8071AB = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BA6428E9F66FD5A23C0A2E06ED26CD2F /* Podfile */,
|
||||
46E7572EB1611944AB13E50F656187E9 /* Development Pods */,
|
||||
BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */,
|
||||
3A648B4C2102C68BD49258688BF389CC /* Products */,
|
||||
A9D31FC7B7A14D2E4651A6C66A1A86EC /* Targets Support Files */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9D31FC7B7A14D2E4651A6C66A1A86EC /* Targets Support Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E6EDC7112547C1E567413310A74E6AB2 /* Pods-DipSampleApp */,
|
||||
02DBDCD39FB1D88711D499C4EE8EE355 /* Pods-DipTests */,
|
||||
);
|
||||
name = "Targets Support Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BF6342C8B29F4CEEA088EFF7AB4DE362 /* iOS */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BF6342C8B29F4CEEA088EFF7AB4DE362 /* iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3E4E89230EF59BC255123B67864ACF77 /* Foundation.framework */,
|
||||
);
|
||||
name = iOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C40734A4DEEFC0C72EE1D1BCF19DD769 /* Dip */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CF3CAD3FD76F762243056FAE7CFCDD9D /* Sources */,
|
||||
480A2A3476910EE7306AD0610F482D25 /* Support Files */,
|
||||
);
|
||||
name = Dip;
|
||||
path = ../..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CF3CAD3FD76F762243056FAE7CFCDD9D /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D1855646D8AC0B232E538D845A7894FF /* Dip.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E6EDC7112547C1E567413310A74E6AB2 /* Pods-DipSampleApp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E2C25F36DD7F27E8BA0BDFFF808541A7 /* Info.plist */,
|
||||
040E6767354650F6353098E4EB50B3F7 /* Pods-DipSampleApp.modulemap */,
|
||||
F5067212B9AFB98F7CCBC7151A60A220 /* Pods-DipSampleApp-acknowledgements.markdown */,
|
||||
3BFEC463C4346DFBB40CFD331E7B8C8C /* Pods-DipSampleApp-acknowledgements.plist */,
|
||||
6DC6F865EBD27FE4416E8655E73F7426 /* Pods-DipSampleApp-dummy.m */,
|
||||
AF0EA8CE3EB9D052ABA91BBDF5935932 /* Pods-DipSampleApp-frameworks.sh */,
|
||||
A37235974396D8B3A4A2163B9FAF0328 /* Pods-DipSampleApp-resources.sh */,
|
||||
ACEDE7C6DC726F30DC3F36A7ECD7A8C2 /* Pods-DipSampleApp-umbrella.h */,
|
||||
4AC7412F56C556428F0902BDB2B9CC74 /* Pods-DipSampleApp.debug.xcconfig */,
|
||||
FCA73F622E211B8366C7D190CE804EA5 /* Pods-DipSampleApp.release.xcconfig */,
|
||||
);
|
||||
name = "Pods-DipSampleApp";
|
||||
path = "Target Support Files/Pods-DipSampleApp";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
91E0558A996F1C7D67CEF7650719B736 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
92915F15583230B1CF7E9FAB6FFD5817 /* Dip-umbrella.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BBAC4F3AB5D36D3D0D5D75D8B850C13E /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CE06FE77C65C0BE8BDD6AFB33EAD328F /* Pods-DipSampleApp-umbrella.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
DD721702CA080CE29A0491036618E6FD /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
DF187AAE55CEA68761E21B080E2C2CF2 /* Pods-DipTests-umbrella.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
28230D259635091F92F106AA282AA138 /* Dip */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 31CFDCC9535978BB70FDA95D6D357629 /* Build configuration list for PBXNativeTarget "Dip" */;
|
||||
buildPhases = (
|
||||
6A1130E1D8B20BCD2F3070FD7541D03E /* Sources */,
|
||||
9E15208AD5F4351018028853ABA69EB9 /* Frameworks */,
|
||||
91E0558A996F1C7D67CEF7650719B736 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Dip;
|
||||
productName = Dip;
|
||||
productReference = E1A14DC75595E6F6652CBCCE34EF2BC2 /* Dip.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
3A53F07A7DBB3101BFCAD512E679F62C /* Pods-DipSampleApp */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B70E7A5902F5B0D610680BC908B731F3 /* Build configuration list for PBXNativeTarget "Pods-DipSampleApp" */;
|
||||
buildPhases = (
|
||||
A943C34198589805B647072D0565220C /* Sources */,
|
||||
ED999B179D5C9983F80D581113B9D018 /* Frameworks */,
|
||||
BBAC4F3AB5D36D3D0D5D75D8B850C13E /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
394A3171C70875A58CBC5E1A1DC019D7 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Pods-DipSampleApp";
|
||||
productName = "Pods-DipSampleApp";
|
||||
productReference = 8A5334FC48EF0DBABDE182FB6C1E6C3D /* Pods_DipSampleApp.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
A282C21E8EC965D4836B3AECBB21F499 /* Pods-DipTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 35DD63728C36940D0AE695EF42CC6F57 /* Build configuration list for PBXNativeTarget "Pods-DipTests" */;
|
||||
buildPhases = (
|
||||
62BE8684290E236F96D180ADDAB07160 /* Sources */,
|
||||
7054D0CB6C690B6BE41E609084CA0958 /* Frameworks */,
|
||||
DD721702CA080CE29A0491036618E6FD /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5541F443020F2B10F9A04FE23958A4C6 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Pods-DipTests";
|
||||
productName = "Pods-DipTests";
|
||||
productReference = 6418C112ABDD19D3EF1DD98DB3019F05 /* Pods_DipTests.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
D41D8CD98F00B204E9800998ECF8427E /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
};
|
||||
buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 7DB346D0F39D3F0E887471402A8071AB;
|
||||
productRefGroup = 3A648B4C2102C68BD49258688BF389CC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
28230D259635091F92F106AA282AA138 /* Dip */,
|
||||
3A53F07A7DBB3101BFCAD512E679F62C /* Pods-DipSampleApp */,
|
||||
A282C21E8EC965D4836B3AECBB21F499 /* Pods-DipTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
62BE8684290E236F96D180ADDAB07160 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
774AC175C524A1E16D01BB9CF19651ED /* Pods-DipTests-dummy.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6A1130E1D8B20BCD2F3070FD7541D03E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3E5EF2244E6759BDB00BF6F862FFAD43 /* Dip-dummy.m in Sources */,
|
||||
73DFA9D2D6721ED2BF48E815083FC935 /* Dip.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
A943C34198589805B647072D0565220C /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
233F81BF5C5FCE081EE3E4963D0B28CD /* Pods-DipSampleApp-dummy.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
394A3171C70875A58CBC5E1A1DC019D7 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = Dip;
|
||||
target = 28230D259635091F92F106AA282AA138 /* Dip */;
|
||||
targetProxy = 62848E69B71441AB05941E7E2F09E1D8 /* PBXContainerItemProxy */;
|
||||
};
|
||||
5541F443020F2B10F9A04FE23958A4C6 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = Dip;
|
||||
target = 28230D259635091F92F106AA282AA138 /* Dip */;
|
||||
targetProxy = F9BC91C90262AF7A128076332A48985F /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1473D344CDCA306DE692B6341E997B38 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 2F6C88DA4612709E46E6E64B8DE3DF7B /* Pods-DipTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
INFOPLIST_FILE = "Target Support Files/Pods-DipTests/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = "Target Support Files/Pods-DipTests/Pods-DipTests.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_LIBTOOLFLAGS = "";
|
||||
PODS_ROOT = "$(SRCROOT)";
|
||||
PRODUCT_NAME = Pods_DipTests;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6A72424D270F509461FC20CD059294D4 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D431A88F8543B8C4079050ACDD792D51 /* Dip.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_PREFIX_HEADER = "Target Support Files/Dip/Dip-prefix.pch";
|
||||
INFOPLIST_FILE = "Target Support Files/Dip/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MODULEMAP_FILE = "Target Support Files/Dip/Dip.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_NAME = Dip;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
78F0B5FBEADFB5A705557C10BE04C413 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 4AC7412F56C556428F0902BDB2B9CC74 /* Pods-DipSampleApp.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
INFOPLIST_FILE = "Target Support Files/Pods-DipSampleApp/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = "Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_LIBTOOLFLAGS = "";
|
||||
PODS_ROOT = "$(SRCROOT)";
|
||||
PRODUCT_NAME = Pods_DipSampleApp;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A70CDAD61F90AC503C7D04CC22DA2923 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
SYMROOT = "${SRCROOT}/../build";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B974ED11B24EB1E4C3321062F24469F4 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D431A88F8543B8C4079050ACDD792D51 /* Dip.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_PREFIX_HEADER = "Target Support Files/Dip/Dip-prefix.pch";
|
||||
INFOPLIST_FILE = "Target Support Files/Dip/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MODULEMAP_FILE = "Target Support Files/Dip/Dip.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_NAME = Dip;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CBDDB14779D5F8C01DB8F4A9A013509C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FCA73F622E211B8366C7D190CE804EA5 /* Pods-DipSampleApp.release.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
INFOPLIST_FILE = "Target Support Files/Pods-DipSampleApp/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = "Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_LIBTOOLFLAGS = "";
|
||||
PODS_ROOT = "$(SRCROOT)";
|
||||
PRODUCT_NAME = Pods_DipSampleApp;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F1BFBC0693AAA13A7013B018CED4126C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D70F3F84928AF07F304E2A78BED54F5E /* Pods-DipTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
INFOPLIST_FILE = "Target Support Files/Pods-DipTests/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MODULEMAP_FILE = "Target Support Files/Pods-DipTests/Pods-DipTests.modulemap";
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = "";
|
||||
OTHER_LIBTOOLFLAGS = "";
|
||||
PODS_ROOT = "$(SRCROOT)";
|
||||
PRODUCT_NAME = Pods_DipTests;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
FB45FFD90572718D82AB9092B750F0CA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
SYMROOT = "${SRCROOT}/../build";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A70CDAD61F90AC503C7D04CC22DA2923 /* Debug */,
|
||||
FB45FFD90572718D82AB9092B750F0CA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
31CFDCC9535978BB70FDA95D6D357629 /* Build configuration list for PBXNativeTarget "Dip" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B974ED11B24EB1E4C3321062F24469F4 /* Debug */,
|
||||
6A72424D270F509461FC20CD059294D4 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
35DD63728C36940D0AE695EF42CC6F57 /* Build configuration list for PBXNativeTarget "Pods-DipTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1473D344CDCA306DE692B6341E997B38 /* Debug */,
|
||||
F1BFBC0693AAA13A7013B018CED4126C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
B70E7A5902F5B0D610680BC908B731F3 /* Build configuration list for PBXNativeTarget "Pods-DipSampleApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
78F0B5FBEADFB5A705557C10BE04C413 /* Debug */,
|
||||
CBDDB14779D5F8C01DB8F4A9A013509C /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForAnalyzing = "YES"
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = 'primary'
|
||||
BlueprintIdentifier = '0CFBD42E9A9E0A9CBD1C8DD7'
|
||||
BlueprintName = 'Dip'
|
||||
ReferencedContainer = 'container:Pods.xcodeproj'
|
||||
BuildableName = 'Dip.framework'>
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
buildConfiguration = "Debug"
|
||||
allowLocationSimulation = "YES">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Dip : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Dip
|
||||
@end
|
||||
@@ -1,4 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double DipVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char DipVersionString[];
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
framework module Dip {
|
||||
umbrella header "Dip-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Dip" "${PODS_ROOT}/Headers/Public"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
SKIP_INSTALL = YES
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,26 +0,0 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## Dip
|
||||
|
||||
Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
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.
|
||||
|
||||
Generated by CocoaPods - http://cocoapods.org
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This application makes use of the following third party libraries:</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
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.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>Dip</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - http://cocoapods.org</string>
|
||||
<key>Title</key>
|
||||
<string></string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_DipSampleApp : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_DipSampleApp
|
||||
@end
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$1"
|
||||
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
||||
elif [ -r "$1" ]; then
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# use filter instead of exclude so missing patterns dont' throw errors
|
||||
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
binary="${destination}/${basename}.framework/${basename}"
|
||||
if ! [ -r "$binary" ]; then
|
||||
binary="${destination}/${basename}"
|
||||
fi
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
# Resign the code if required by the build settings to avoid unstable apps
|
||||
code_sign_if_enabled "${destination}/$(basename "$1")"
|
||||
|
||||
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
||||
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
||||
local swift_runtime_libs
|
||||
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
|
||||
for lib in $swift_runtime_libs; do
|
||||
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
|
||||
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
||||
code_sign_if_enabled "${destination}/${lib}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
# Use the current code_sign_identitiy
|
||||
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
||||
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
|
||||
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
# Get architectures for current file
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
stripped="$stripped $arch"
|
||||
fi
|
||||
done
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "Pods-DipSampleApp/Dip.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "Pods-DipSampleApp/Dip.framework"
|
||||
fi
|
||||
@@ -1,95 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
|
||||
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
||||
> "$RESOURCES_TO_COPY"
|
||||
|
||||
XCASSET_FILES=()
|
||||
|
||||
realpath() {
|
||||
DIRECTORY="$(cd "${1%/*}" && pwd)"
|
||||
FILENAME="${1##*/}"
|
||||
echo "$DIRECTORY/$FILENAME"
|
||||
}
|
||||
|
||||
install_resource()
|
||||
{
|
||||
case $1 in
|
||||
*.storyboard)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
;;
|
||||
*.xcdatamodel)
|
||||
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\""
|
||||
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom"
|
||||
;;
|
||||
*.xcdatamodeld)
|
||||
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
|
||||
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
|
||||
;;
|
||||
*.xcmappingmodel)
|
||||
echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\""
|
||||
xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
|
||||
;;
|
||||
*.xcassets)
|
||||
ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
|
||||
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
||||
;;
|
||||
/*)
|
||||
echo "$1"
|
||||
echo "$1" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
*)
|
||||
echo "${PODS_ROOT}/$1"
|
||||
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
||||
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
fi
|
||||
rm -f "$RESOURCES_TO_COPY"
|
||||
|
||||
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
|
||||
then
|
||||
case "${TARGETED_DEVICE_FAMILY}" in
|
||||
1,2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
||||
;;
|
||||
1)
|
||||
TARGET_DEVICE_ARGS="--target-device iphone"
|
||||
;;
|
||||
2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad"
|
||||
;;
|
||||
*)
|
||||
TARGET_DEVICE_ARGS="--target-device mac"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
|
||||
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
|
||||
while read line; do
|
||||
if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
|
||||
XCASSET_FILES+=("$line")
|
||||
fi
|
||||
done <<<"$OTHER_XCASSETS"
|
||||
|
||||
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double Pods_DipSampleAppVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char Pods_DipSampleAppVersionString[];
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Dip.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Dip"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-DipSampleApp
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
@@ -1,6 +0,0 @@
|
||||
framework module Pods_DipSampleApp {
|
||||
umbrella header "Pods-DipSampleApp-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Dip.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Dip"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-DipSampleApp
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,26 +0,0 @@
|
||||
# Acknowledgements
|
||||
This application makes use of the following third party libraries:
|
||||
|
||||
## Dip
|
||||
|
||||
Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
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.
|
||||
|
||||
Generated by CocoaPods - http://cocoapods.org
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This application makes use of the following third party libraries:</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Olivier Halligon <olivier@halligon.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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
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.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>Dip</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Generated by CocoaPods - http://cocoapods.org</string>
|
||||
<key>Title</key>
|
||||
<string></string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Acknowledgements</string>
|
||||
<key>Title</key>
|
||||
<string>Acknowledgements</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Pods_DipTests : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Pods_DipTests
|
||||
@end
|
||||
@@ -1,91 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
||||
|
||||
install_framework()
|
||||
{
|
||||
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$1"
|
||||
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
||||
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
||||
elif [ -r "$1" ]; then
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
source="$(readlink "${source}")"
|
||||
fi
|
||||
|
||||
# use filter instead of exclude so missing patterns dont' throw errors
|
||||
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
|
||||
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
||||
|
||||
local basename
|
||||
basename="$(basename -s .framework "$1")"
|
||||
binary="${destination}/${basename}.framework/${basename}"
|
||||
if ! [ -r "$binary" ]; then
|
||||
binary="${destination}/${basename}"
|
||||
fi
|
||||
|
||||
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
||||
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
||||
strip_invalid_archs "$binary"
|
||||
fi
|
||||
|
||||
# Resign the code if required by the build settings to avoid unstable apps
|
||||
code_sign_if_enabled "${destination}/$(basename "$1")"
|
||||
|
||||
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
||||
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
||||
local swift_runtime_libs
|
||||
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
|
||||
for lib in $swift_runtime_libs; do
|
||||
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
|
||||
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
||||
code_sign_if_enabled "${destination}/${lib}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Signs a framework with the provided identity
|
||||
code_sign_if_enabled() {
|
||||
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
||||
# Use the current code_sign_identitiy
|
||||
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
||||
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
|
||||
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Strip invalid architectures
|
||||
strip_invalid_archs() {
|
||||
binary="$1"
|
||||
# Get architectures for current file
|
||||
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
|
||||
stripped=""
|
||||
for arch in $archs; do
|
||||
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
|
||||
# Strip non-valid architectures in-place
|
||||
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
||||
stripped="$stripped $arch"
|
||||
fi
|
||||
done
|
||||
if [[ "$stripped" ]]; then
|
||||
echo "Stripped $binary of architectures:$stripped"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "Pods-DipTests/Dip.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "Pods-DipTests/Dip.framework"
|
||||
fi
|
||||
@@ -1,95 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
|
||||
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
||||
> "$RESOURCES_TO_COPY"
|
||||
|
||||
XCASSET_FILES=()
|
||||
|
||||
realpath() {
|
||||
DIRECTORY="$(cd "${1%/*}" && pwd)"
|
||||
FILENAME="${1##*/}"
|
||||
echo "$DIRECTORY/$FILENAME"
|
||||
}
|
||||
|
||||
install_resource()
|
||||
{
|
||||
case $1 in
|
||||
*.storyboard)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.xib)
|
||||
echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
|
||||
ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
|
||||
;;
|
||||
*.framework)
|
||||
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
;;
|
||||
*.xcdatamodel)
|
||||
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\""
|
||||
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom"
|
||||
;;
|
||||
*.xcdatamodeld)
|
||||
echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\""
|
||||
xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd"
|
||||
;;
|
||||
*.xcmappingmodel)
|
||||
echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\""
|
||||
xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
|
||||
;;
|
||||
*.xcassets)
|
||||
ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
|
||||
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
||||
;;
|
||||
/*)
|
||||
echo "$1"
|
||||
echo "$1" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
*)
|
||||
echo "${PODS_ROOT}/$1"
|
||||
echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
||||
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
fi
|
||||
rm -f "$RESOURCES_TO_COPY"
|
||||
|
||||
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
|
||||
then
|
||||
case "${TARGETED_DEVICE_FAMILY}" in
|
||||
1,2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
||||
;;
|
||||
1)
|
||||
TARGET_DEVICE_ARGS="--target-device iphone"
|
||||
;;
|
||||
2)
|
||||
TARGET_DEVICE_ARGS="--target-device ipad"
|
||||
;;
|
||||
*)
|
||||
TARGET_DEVICE_ARGS="--target-device mac"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
|
||||
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
|
||||
while read line; do
|
||||
if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
|
||||
XCASSET_FILES+=("$line")
|
||||
fi
|
||||
done <<<"$OTHER_XCASSETS"
|
||||
|
||||
printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
FOUNDATION_EXPORT double Pods_DipTestsVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char Pods_DipTestsVersionString[];
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Dip.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Dip"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-DipTests
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
@@ -1,6 +0,0 @@
|
||||
framework module Pods_DipTests {
|
||||
umbrella header "Pods-DipTests-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Dip.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "Dip"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-DipTests
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
@@ -36,15 +36,33 @@ it, simply add the following line to your Podfile:
|
||||
pod "Dip"
|
||||
```
|
||||
|
||||
If you use _Carthage_ add this line to your Cartfile:
|
||||
|
||||
```
|
||||
github "AliSoftware/Dip"
|
||||
```
|
||||
|
||||
## Playground
|
||||
|
||||
Dip comes with a **Playground** to introduce you to Inversion of Control, Dependency Injection, and how to use Dip in practice.
|
||||
|
||||
To play with it, [open `Dip.xcworkspace`](Dip/Dip.xcworkspace), then click on the `DipPlayground` entry in Xcode's Project Navigator and let it be your guide.
|
||||
|
||||
_Note: Do not open the `DipPlayground.playground` file directly, as it needs to be part of the workspace to access the Dip framework so that the demo code it contains can work._
|
||||
|
||||
The next paragraphs give you an overview of the Usage of _Dip_ directly, but if you're new to Dependency Injection, the Playground is probably a better start.
|
||||
|
||||
## Usage
|
||||
|
||||
### Register instances and instance factories
|
||||
*See [CHANGELOG.md](https://github.com/AliSoftware/Dip/blob/master/CHANGELOG.md) for instructions to migrate from 2.0.0 to 3.0.0*
|
||||
|
||||
First, create a `DependencyContainer` and use it to register instances and factories with protocols, using those methods:
|
||||
### Register instance factories
|
||||
|
||||
* `register(instance: _)` will register a singleton instance with a given protocol.
|
||||
* `register(factory: _)` will register an instance factory — which generates a new instance each time you `resolve()`.
|
||||
* You need **cast the instance to the protocol type** you want to register it with (e.g. `register(instance: PlistUsersProvider() as UsersListProviderType)`).
|
||||
First, create a `DependencyContainer` and use it to register instance factories with protocols, using those methods:
|
||||
|
||||
* `register(.Singleton) { … }` will register a singleton instance with a given protocol.
|
||||
* `register(.Prototype) { … }` (or just `register { … }`) will register an instance factory which generates a new instance each time you `resolve()`.
|
||||
* You need **cast the instance to the protocol type** you want to register it with (e.g. `register { PlistUsersProvider() as UsersListProviderType }`).
|
||||
|
||||
Typically, to register your dependencies as early as possible in your app life-cycle, you will declare a `let dip: DependencyContainer = { … }()` somewhere (for example [in a dedicated `.swift` file](https://github.com/AliSoftware/Dip/blob/master/Example/DipSampleApp/DependencyContainers.swift#L22-L27)). In your (non-hosted, standalone) unit tests, you'll probably [reset them in your `func setUp()`](https://github.com/AliSoftware/Dip/blob/master/Example/Tests/SWAPIPersonProviderTests.swift#L17-L21) instead.
|
||||
|
||||
@@ -52,7 +70,19 @@ Typically, to register your dependencies as early as possible in your app life-c
|
||||
|
||||
* `resolve()` will return a new instance matching the requested protocol.
|
||||
* Explicitly specify the return type of `resolve` so that Swift's type inference knows which protocol you're trying to resolve.
|
||||
* If that protocol was registered as a singleton instance (using `register(instance: …)`, the same instance will be returned each time you call `resolve()` for this protocol type. Otherwise, the instance factory will generate a new instance each time.
|
||||
|
||||
```swift
|
||||
container.register { ServiceImp() as Service }
|
||||
let service = container.resolve() as Service
|
||||
```
|
||||
|
||||
### Scopes
|
||||
|
||||
Dip provides two _scopes_ that you can use to register dependencies:
|
||||
|
||||
* The `.Prototype` scope will make the `DependencyContainer` resolve your type as __a new instance every time__ you call `resolve`. It's a default scope.
|
||||
* The `.Singleton` scope will make the `DependencyContainer` retain the instance once resolved the first time, and reuse it in the next calls to `resolve` during the container lifetime.
|
||||
|
||||
|
||||
### Using block-based initialization
|
||||
|
||||
@@ -64,8 +94,8 @@ It may not seem to provide much, but given the fact that `DependencyContainers`
|
||||
let dip: DependencyContainer = {
|
||||
let dip = DependencyContainer()
|
||||
|
||||
dip.register(instance: ProductionEnvironment(analytics: true) as EnvironmentType)
|
||||
dip.register(instance: WebService() as WebServiceAPI)
|
||||
dip.register { ProductionEnvironment(analytics: true) as EnvironmentType }
|
||||
dip.register { WebService() as WebServiceAPI }
|
||||
|
||||
return dip
|
||||
}()
|
||||
@@ -75,15 +105,15 @@ You can instead write this exact equivalent code, which is more compact, and ind
|
||||
|
||||
```swift
|
||||
let dip = DependencyContainer { dip in
|
||||
dip.register(instance: ProductionEnvironment(analytics: true) as EnvironmentType)
|
||||
dip.register(instance: WebService() as WebServiceAPI)
|
||||
dip.register { ProductionEnvironment(analytics: true) as EnvironmentType }
|
||||
dip.register { WebService() as WebServiceAPI }
|
||||
}
|
||||
```
|
||||
|
||||
### Using tags to associate various factories to one protocol
|
||||
|
||||
* If you give a `tag` in the parameter to `register()`, it will associate that instance or factory with this tag, which can be used later during `resolve` (see below).
|
||||
* `resolve(tag)` will try to find an instance (or instance factory) that match both the requested protocol _and_ the tag. If it doesn't find any, it will fallback to an instance (or instance factory) that only match the requested protocol.
|
||||
* `resolve(tag: tag)` will try to find an instance (or instance factory) that match both the requested protocol _and_ the tag. If it doesn't find any, it will fallback to an instance (or instance factory) that only match the requested protocol.
|
||||
* The tags can be StringLiteralType or IntegerLiteralType. That said you can use plain strings or integers as tags.
|
||||
|
||||
|
||||
@@ -94,12 +124,42 @@ enum WebService: String {
|
||||
var tag: Tag { return Tag.String(self.rawValue) }
|
||||
}
|
||||
|
||||
let wsDependencies = DependencyContainer<WebService>() { dip in
|
||||
dip.register(WebService.PersonWS.tag, instance: URLSessionNetworkLayer(baseURL: "http://prod.myapi.com/api/")! as NetworkLayer)
|
||||
dip.register(WebService.StashipWS.tag, instance: URLSessionNetworkLayer(baseURL: "http://dev.myapi.com/api/")! as NetworkLayer)
|
||||
let wsDependencies = DependencyContainer() { dip in
|
||||
dip.register(tag: WebService.PersonWS.tag) { URLSessionNetworkLayer(baseURL: "http://prod.myapi.com/api/")! as NetworkLayer }
|
||||
dip.register(tag: WebService.StashipWS.tag) { URLSessionNetworkLayer(baseURL: "http://dev.myapi.com/api/")! as NetworkLayer }
|
||||
}
|
||||
|
||||
let networkLayer = dip.resolve(tag: WebService.PersonWS.tag) as NetworkLayer
|
||||
```
|
||||
|
||||
### Runtime arguments
|
||||
|
||||
You can register factories that accept up to six arguments. When you resolve dependency you can pass those arguments to `resolve()` method and they will be passed to the factory. Note that _number_, _types_ and _order_ of parameters matters. Also use of optional parameter and not optional parameter will result in two factories registered in container.
|
||||
|
||||
```swift
|
||||
let webServices = DependencyContainer() { webServices in
|
||||
webServices.register { (url: NSURL, port: Int) in WebServiceImp1(url, port: port) as WebServiceAPI }
|
||||
webServices.register { (port: Int, url: NSURL) in WebServiceImp2(url, port: port) as WebServiceAPI }
|
||||
webServices.register { (port: Int, url: NSURL?) in WebServiceImp3(url!, port: port) as WebServiceAPI }
|
||||
}
|
||||
|
||||
let service1 = webServices.resolve(withArguments: NSURL(string: "http://example.url")!, 80) as WebServiceAPI // service1 is WebServiceImp1
|
||||
let service2 = webServices.resolve(withArguments: 80, NSURL(string: "http://example.url")!) as WebServiceAPI // service2 is WebServiceImp2
|
||||
let service3 = webServices.resolve(withArguments: 80, NSURL(string: "http://example.url")) as WebServiceAPI // service3 is WebServiceImp3
|
||||
|
||||
```
|
||||
Though Dip provides support for up to six runtime arguments out of the box you can extend this number using following code snippet for seven arguments:
|
||||
|
||||
```
|
||||
func register<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(tag: Tag? = nil, scope: ComponentScope = .Prototype, factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> T) -> DefinitionOf<T, (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> T)> {
|
||||
return registerFactory(tag, scope: .Prototype, factory: factory) as DefinitionOf<T, (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> T)>
|
||||
}
|
||||
|
||||
func resolve<T, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7>(tag tag: Tag? = nil, withArguments arg1: Arg1, _ arg2: Arg2, _ arg3: Arg3, _ arg4: Arg4, _ arg5: Arg5, _ arg6: Arg6, _ arg7: Arg7) -> T {
|
||||
return resolve(tag) { (factory: (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) -> T) in factory(arg1, arg2, arg3, arg4, arg5, arg6, arg7) }
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Concrete Example
|
||||
|
||||
@@ -109,10 +169,10 @@ Somewhere in your App target, register the dependencies:
|
||||
let dip: DependencyContainer = {
|
||||
let dip = DependencyContainer()
|
||||
let env = ProductionEnvironment(analytics: true)
|
||||
dip.register(instance: env as EnvironmentType)
|
||||
dip.register(instance: WebService() as WebServiceType)
|
||||
dip.register() { DummyFriendsProvider(user: $0 ?? "Jane Doe") as FriendsProviderType }
|
||||
dip.register("me") { PlistFriendsProvider(plist: "myfriends") as FriendsProviderType }
|
||||
dip.register(.Singleton) { env as EnvironmentType }
|
||||
dip.register(.Singleton) { WebService() as WebServiceType }
|
||||
dip.register() { (name: String) in DummyFriendsProvider(user: name) as FriendsProviderType }
|
||||
dip.register(tag: "me") { (_: String) in PlistFriendsProvider(plist: "myfriends") as FriendsProviderType }
|
||||
return dip
|
||||
}
|
||||
```
|
||||
@@ -134,7 +194,7 @@ struct SomeViewModel {
|
||||
let ws: WebServiceType = dip.resolve()
|
||||
var friendsProvider: FriendsProviderType
|
||||
init(userName: String) {
|
||||
friendsProvider = dip.resolve(userName)
|
||||
friendsProvider = dip.resolve(tag: userName, userName)
|
||||
}
|
||||
func foo() {
|
||||
ws.someMethodDeclaredOnWebServiceType()
|
||||
@@ -146,13 +206,13 @@ struct SomeViewModel {
|
||||
This way, when running your app target:
|
||||
|
||||
* `ws` will be resolved as your singleton instance `WebService` registered before.
|
||||
* `friendsProvider` will be resolved as a new instance each time, which will be an instance created via `PlistFriendsProvider(plist: "myfriends")` if `userName` is `me` and created via `DummyFriendsProvider(userName)` for any other `userName` value (because `resolve(userName)` will fallback to `resolve(nil)` in that case, using the instance factory which was registered without a tag).
|
||||
* `friendsProvider` will be resolved as a new instance each time, which will be an instance created via `PlistFriendsProvider(plist: "myfriends")` if `userName` is `me` and created via `DummyFriendsProvider(userName)` for any other `userName` value (because `resolve(tag: userName, userName)` will fallback to `resolve(tag: nil, userName)` in that case, using the instance factory which was registered without a tag, but will pass `userName` as argument).
|
||||
|
||||
But when running your Unit tests target, it will probably resolve to other instances, depending on how you registered your dependencies in your Test Case.
|
||||
|
||||
### Complete Example Project
|
||||
|
||||
You can find a complete example in the `Example/DipSampleApp` project provided in this repository.
|
||||
In addition to this Usage overview and to the aforementioned playground, you can also find a complete example in the `SampleApp/DipSampleApp` project provided in this repository.
|
||||
|
||||
This sample project is a bit more complex, but closer to real-world applications (even if this sample is all about StarWars!),
|
||||
by declaring protocols like `NetworkLayer` which can be resolved to a `URLSessionNetworkLayer` in the real app, but to a dummy
|
||||
@@ -163,7 +223,8 @@ This sample uses the Star Wars API provided by swapi.co to fetch Star Wars chara
|
||||
|
||||
## Credits
|
||||
|
||||
This library is authored by **Olivier Halligon**, olivier@halligon.net
|
||||
This library has been created by [**Olivier Halligon**](olivier@halligon.net).
|
||||
I'd also like to thank [**Ilya Puchka**](https://twitter.com/ilyapuchka) for his big contribution to it, as he added a lot of great features to it.
|
||||
|
||||
**Dip** is available under the **MIT license**. See the `LICENSE` file for more info.
|
||||
|
||||
|
||||
@@ -7,45 +7,45 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
090012291BC6FECA0079C600 /* BaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012161BC6FECA0079C600 /* BaseCell.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900122A1BC6FECA0079C600 /* PersonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012171BC6FECA0079C600 /* PersonCell.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900122C1BC6FECA0079C600 /* PersonProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121B1BC6FECA0079C600 /* PersonProviderAPI.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900122D1BC6FECA0079C600 /* DummyPilotProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121C1BC6FECA0079C600 /* DummyPilotProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900122E1BC6FECA0079C600 /* HardCodedStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121D1BC6FECA0079C600 /* HardCodedStarshipProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900122F1BC6FECA0079C600 /* PlistPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121E1BC6FECA0079C600 /* PlistPersonProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
0900123B1BC6FF4D0079C600 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0900123A1BC6FF4D0079C600 /* Main.storyboard */; settings = {ASSET_TAGS = (); }; };
|
||||
0900123D1BC7012A0079C600 /* StarshipProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123C1BC7012A0079C600 /* StarshipProviderAPI.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
090012401BC704C60079C600 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123F1BC704C60079C600 /* Person.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
090012421BC7059E0079C600 /* Starship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012411BC7059E0079C600 /* Starship.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
090012441BC708A00079C600 /* DummyStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012431BC708A00079C600 /* DummyStarshipProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
090012291BC6FECA0079C600 /* BaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012161BC6FECA0079C600 /* BaseCell.swift */; };
|
||||
0900122A1BC6FECA0079C600 /* PersonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012171BC6FECA0079C600 /* PersonCell.swift */; };
|
||||
0900122C1BC6FECA0079C600 /* PersonProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121B1BC6FECA0079C600 /* PersonProviderAPI.swift */; };
|
||||
0900122D1BC6FECA0079C600 /* DummyPilotProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121C1BC6FECA0079C600 /* DummyPilotProvider.swift */; };
|
||||
0900122E1BC6FECA0079C600 /* HardCodedStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121D1BC6FECA0079C600 /* HardCodedStarshipProvider.swift */; };
|
||||
0900122F1BC6FECA0079C600 /* PlistPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121E1BC6FECA0079C600 /* PlistPersonProvider.swift */; };
|
||||
0900123B1BC6FF4D0079C600 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0900123A1BC6FF4D0079C600 /* Main.storyboard */; };
|
||||
0900123D1BC7012A0079C600 /* StarshipProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123C1BC7012A0079C600 /* StarshipProviderAPI.swift */; };
|
||||
090012401BC704C60079C600 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123F1BC704C60079C600 /* Person.swift */; };
|
||||
090012421BC7059E0079C600 /* Starship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012411BC7059E0079C600 /* Starship.swift */; };
|
||||
090012441BC708A00079C600 /* DummyStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012431BC708A00079C600 /* DummyStarshipProvider.swift */; };
|
||||
099022621BC123C000E76F43 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099022611BC123C000E76F43 /* AppDelegate.swift */; };
|
||||
099022691BC123C000E76F43 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 099022681BC123C000E76F43 /* Assets.xcassets */; };
|
||||
0990226C1BC123C000E76F43 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0990226A1BC123C000E76F43 /* LaunchScreen.storyboard */; };
|
||||
09D795FF1BC71F5A003C68EB /* PersonListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D795FE1BC71F5A003C68EB /* PersonListViewController.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796011BC722C0003C68EB /* StarshipListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796001BC722C0003C68EB /* StarshipListViewController.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796031BC72691003C68EB /* StarshipCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796021BC72691003C68EB /* StarshipCell.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796071BC73E8B003C68EB /* StoryboardConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796061BC73E8B003C68EB /* StoryboardConstants.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D7960D1BC7431C003C68EB /* FetchableTrait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7960C1BC7431C003C68EB /* FetchableTrait.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796111BC97809003C68EB /* mainPilot.plist in Resources */ = {isa = PBXBuildFile; fileRef = 09D796101BC97809003C68EB /* mainPilot.plist */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796131BC9A5BC003C68EB /* SWAPIPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796121BC9A5BC003C68EB /* SWAPIPersonProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796151BC9A5FC003C68EB /* NetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796141BC9A5FC003C68EB /* NetworkLayer.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796171BC9B53D003C68EB /* URLSessionNetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796161BC9B53D003C68EB /* URLSessionNetworkLayer.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796191BC9BA49003C68EB /* DependencyContainers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796181BC9BA49003C68EB /* DependencyContainers.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D7961B1BC9BE65003C68EB /* SWAPIStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961A1BC9BE65003C68EB /* SWAPIStarshipProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D7961D1BC9C62E003C68EB /* SWAPICommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961C1BC9C62E003C68EB /* SWAPICommon.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796221BCA8305003C68EB /* NetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796141BC9A5FC003C68EB /* NetworkLayer.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796231BCA833E003C68EB /* SWAPIPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796121BC9A5BC003C68EB /* SWAPIPersonProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796241BCA8345003C68EB /* PersonProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121B1BC6FECA0079C600 /* PersonProviderAPI.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796251BCA8345003C68EB /* StarshipProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123C1BC7012A0079C600 /* StarshipProviderAPI.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796261BCA8348003C68EB /* SWAPIStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961A1BC9BE65003C68EB /* SWAPIStarshipProvider.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796271BCA8550003C68EB /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123F1BC704C60079C600 /* Person.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796281BCA8550003C68EB /* Starship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012411BC7059E0079C600 /* Starship.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D796291BCA86D4003C68EB /* SWAPICommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961C1BC9C62E003C68EB /* SWAPICommon.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D7962C1BCA8AD4003C68EB /* NetworkMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7962A1BCA8AB3003C68EB /* NetworkMock.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09D7962F1BCA922E003C68EB /* SWAPIStarshipProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7962D1BCA91D3003C68EB /* SWAPIStarshipProviderTests.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
09B041B71C01F8CB000D383F /* Dip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09B041B61C01F8CB000D383F /* Dip.framework */; };
|
||||
09B041B81C01F8D1000D383F /* Dip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09B041B61C01F8CB000D383F /* Dip.framework */; };
|
||||
09D795FF1BC71F5A003C68EB /* PersonListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D795FE1BC71F5A003C68EB /* PersonListViewController.swift */; };
|
||||
09D796011BC722C0003C68EB /* StarshipListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796001BC722C0003C68EB /* StarshipListViewController.swift */; };
|
||||
09D796031BC72691003C68EB /* StarshipCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796021BC72691003C68EB /* StarshipCell.swift */; };
|
||||
09D796071BC73E8B003C68EB /* StoryboardConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796061BC73E8B003C68EB /* StoryboardConstants.swift */; };
|
||||
09D7960D1BC7431C003C68EB /* FetchableTrait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7960C1BC7431C003C68EB /* FetchableTrait.swift */; };
|
||||
09D796111BC97809003C68EB /* mainPilot.plist in Resources */ = {isa = PBXBuildFile; fileRef = 09D796101BC97809003C68EB /* mainPilot.plist */; };
|
||||
09D796131BC9A5BC003C68EB /* SWAPIPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796121BC9A5BC003C68EB /* SWAPIPersonProvider.swift */; };
|
||||
09D796151BC9A5FC003C68EB /* NetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796141BC9A5FC003C68EB /* NetworkLayer.swift */; };
|
||||
09D796171BC9B53D003C68EB /* URLSessionNetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796161BC9B53D003C68EB /* URLSessionNetworkLayer.swift */; };
|
||||
09D796191BC9BA49003C68EB /* DependencyContainers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796181BC9BA49003C68EB /* DependencyContainers.swift */; };
|
||||
09D7961B1BC9BE65003C68EB /* SWAPIStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961A1BC9BE65003C68EB /* SWAPIStarshipProvider.swift */; };
|
||||
09D7961D1BC9C62E003C68EB /* SWAPICommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961C1BC9C62E003C68EB /* SWAPICommon.swift */; };
|
||||
09D796221BCA8305003C68EB /* NetworkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796141BC9A5FC003C68EB /* NetworkLayer.swift */; };
|
||||
09D796231BCA833E003C68EB /* SWAPIPersonProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D796121BC9A5BC003C68EB /* SWAPIPersonProvider.swift */; };
|
||||
09D796241BCA8345003C68EB /* PersonProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900121B1BC6FECA0079C600 /* PersonProviderAPI.swift */; };
|
||||
09D796251BCA8345003C68EB /* StarshipProviderAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123C1BC7012A0079C600 /* StarshipProviderAPI.swift */; };
|
||||
09D796261BCA8348003C68EB /* SWAPIStarshipProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961A1BC9BE65003C68EB /* SWAPIStarshipProvider.swift */; };
|
||||
09D796271BCA8550003C68EB /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0900123F1BC704C60079C600 /* Person.swift */; };
|
||||
09D796281BCA8550003C68EB /* Starship.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090012411BC7059E0079C600 /* Starship.swift */; };
|
||||
09D796291BCA86D4003C68EB /* SWAPICommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7961C1BC9C62E003C68EB /* SWAPICommon.swift */; };
|
||||
09D7962C1BCA8AD4003C68EB /* NetworkMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7962A1BCA8AB3003C68EB /* NetworkMock.swift */; };
|
||||
09D7962F1BCA922E003C68EB /* SWAPIStarshipProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D7962D1BCA91D3003C68EB /* SWAPIStarshipProviderTests.swift */; };
|
||||
607FACEC1AFB9204008FA782 /* SWAPIPersonProviderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* SWAPIPersonProviderTests.swift */; };
|
||||
7BBD849465D99D9D1987AE6D /* Pods_DipTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304AD039660A2C58EB08D985 /* Pods_DipTests.framework */; };
|
||||
84D8EBE5B2D583BEFB17C45A /* Pods_DipSampleApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FE9C70E965FF88C3F20AC76 /* Pods_DipSampleApp.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -60,12 +60,12 @@
|
||||
0900123F1BC704C60079C600 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
|
||||
090012411BC7059E0079C600 /* Starship.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Starship.swift; sourceTree = "<group>"; };
|
||||
090012431BC708A00079C600 /* DummyStarshipProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DummyStarshipProvider.swift; sourceTree = "<group>"; };
|
||||
097D52FE1BC18A09006C893C /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = "<group>"; };
|
||||
0990225F1BC123C000E76F43 /* DipSampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DipSampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
099022611BC123C000E76F43 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
099022681BC123C000E76F43 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
0990226B1BC123C000E76F43 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
0990226D1BC123C000E76F43 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
09B041B61C01F8CB000D383F /* Dip.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Dip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
09D795FE1BC71F5A003C68EB /* PersonListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonListViewController.swift; sourceTree = "<group>"; };
|
||||
09D796001BC722C0003C68EB /* StarshipListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarshipListViewController.swift; sourceTree = "<group>"; };
|
||||
09D796021BC72691003C68EB /* StarshipCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarshipCell.swift; sourceTree = "<group>"; };
|
||||
@@ -80,18 +80,9 @@
|
||||
09D7961C1BC9C62E003C68EB /* SWAPICommon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SWAPICommon.swift; sourceTree = "<group>"; };
|
||||
09D7962A1BCA8AB3003C68EB /* NetworkMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkMock.swift; sourceTree = "<group>"; };
|
||||
09D7962D1BCA91D3003C68EB /* SWAPIStarshipProviderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SWAPIStarshipProviderTests.swift; sourceTree = "<group>"; };
|
||||
2FE9C70E965FF88C3F20AC76 /* Pods_DipSampleApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DipSampleApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
304AD039660A2C58EB08D985 /* Pods_DipTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DipTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACE51AFB9204008FA782 /* DipTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DipTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACE51AFB9204008FA782 /* DipSampleAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DipSampleAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
607FACEB1AFB9204008FA782 /* SWAPIPersonProviderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SWAPIPersonProviderTests.swift; sourceTree = "<group>"; };
|
||||
64B6CB26CB93DFD18565BB72 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
|
||||
6AB71DAFECF410F2FB12A44C /* Pods-DipSampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DipSampleApp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7E5EDFB4A9194B50CAED7E1A /* Pods-DipTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DipTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DipTests/Pods-DipTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9B78063878AFC700C876DEE9 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
|
||||
B16085421B606723B72DE694 /* Pods-DipSampleApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DipSampleApp.release.xcconfig"; path = "Pods/Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp.release.xcconfig"; sourceTree = "<group>"; };
|
||||
D9BBF14E74848332935F75C4 /* Pods-DipTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DipTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DipTests/Pods-DipTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
FDB7C1D2EFEC1BA700762782 /* Dip.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Dip.podspec; path = ../Dip.podspec; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -99,7 +90,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
84D8EBE5B2D583BEFB17C45A /* Pods_DipSampleApp.framework in Frameworks */,
|
||||
09B041B71C01F8CB000D383F /* Dip.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -107,7 +98,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7BBD849465D99D9D1987AE6D /* Pods_DipTests.framework in Frameworks */,
|
||||
09B041B81C01F8D1000D383F /* Dip.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -207,8 +198,7 @@
|
||||
1A92CB92072DE61786F63E4C /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2FE9C70E965FF88C3F20AC76 /* Pods_DipSampleApp.framework */,
|
||||
304AD039660A2C58EB08D985 /* Pods_DipTests.framework */,
|
||||
09B041B61C01F8CB000D383F /* Dip.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -216,19 +206,17 @@
|
||||
607FACC71AFB9204008FA782 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACF51AFB993E008FA782 /* Podspec Metadata */,
|
||||
099022601BC123C000E76F43 /* DipSampleApp */,
|
||||
607FACE81AFB9204008FA782 /* Tests */,
|
||||
607FACD11AFB9204008FA782 /* Products */,
|
||||
1A92CB92072DE61786F63E4C /* Frameworks */,
|
||||
B10E0DA4AD9E022CCA0B272F /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACD11AFB9204008FA782 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
607FACE51AFB9204008FA782 /* DipTests.xctest */,
|
||||
607FACE51AFB9204008FA782 /* DipSampleAppTests.xctest */,
|
||||
0990225F1BC123C000E76F43 /* DipSampleApp.app */,
|
||||
);
|
||||
name = Products;
|
||||
@@ -253,28 +241,6 @@
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACF51AFB993E008FA782 /* Podspec Metadata */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FDB7C1D2EFEC1BA700762782 /* Dip.podspec */,
|
||||
64B6CB26CB93DFD18565BB72 /* README.md */,
|
||||
097D52FE1BC18A09006C893C /* CHANGELOG.md */,
|
||||
9B78063878AFC700C876DEE9 /* LICENSE */,
|
||||
);
|
||||
name = "Podspec Metadata";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B10E0DA4AD9E022CCA0B272F /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6AB71DAFECF410F2FB12A44C /* Pods-DipSampleApp.debug.xcconfig */,
|
||||
B16085421B606723B72DE694 /* Pods-DipSampleApp.release.xcconfig */,
|
||||
7E5EDFB4A9194B50CAED7E1A /* Pods-DipTests.debug.xcconfig */,
|
||||
D9BBF14E74848332935F75C4 /* Pods-DipTests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -282,12 +248,9 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 0990226E1BC123C000E76F43 /* Build configuration list for PBXNativeTarget "DipSampleApp" */;
|
||||
buildPhases = (
|
||||
52BA3DF5A38A73C99738362E /* Check Pods Manifest.lock */,
|
||||
0990225B1BC123C000E76F43 /* Sources */,
|
||||
0990225C1BC123C000E76F43 /* Frameworks */,
|
||||
0990225D1BC123C000E76F43 /* Resources */,
|
||||
586A7844323215ADA94020FD /* Embed Pods Frameworks */,
|
||||
8665FFA2238FD898C8846391 /* Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -298,24 +261,21 @@
|
||||
productReference = 0990225F1BC123C000E76F43 /* DipSampleApp.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
607FACE41AFB9204008FA782 /* DipTests */ = {
|
||||
607FACE41AFB9204008FA782 /* DipSampleAppTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DipTests" */;
|
||||
buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DipSampleAppTests" */;
|
||||
buildPhases = (
|
||||
5CA726E6162DF780766DC6CA /* Check Pods Manifest.lock */,
|
||||
607FACE11AFB9204008FA782 /* Sources */,
|
||||
607FACE21AFB9204008FA782 /* Frameworks */,
|
||||
607FACE31AFB9204008FA782 /* Resources */,
|
||||
7982A68D936539C16CA74E2D /* Embed Pods Frameworks */,
|
||||
B0AB134AABD1E8CE42E5A2EC /* Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = DipTests;
|
||||
name = DipSampleAppTests;
|
||||
productName = Tests;
|
||||
productReference = 607FACE51AFB9204008FA782 /* DipTests.xctest */;
|
||||
productReference = 607FACE51AFB9204008FA782 /* DipSampleAppTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@@ -336,7 +296,7 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Dip" */;
|
||||
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DipSampleApp" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
@@ -350,7 +310,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
0990225E1BC123C000E76F43 /* DipSampleApp */,
|
||||
607FACE41AFB9204008FA782 /* DipTests */,
|
||||
607FACE41AFB9204008FA782 /* DipSampleAppTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -376,99 +336,6 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
52BA3DF5A38A73C99738362E /* Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
586A7844323215ADA94020FD /* Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
5CA726E6162DF780766DC6CA /* Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
7982A68D936539C16CA74E2D /* Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DipTests/Pods-DipTests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
8665FFA2238FD898C8846391 /* Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DipSampleApp/Pods-DipSampleApp-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
B0AB134AABD1E8CE42E5A2EC /* Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DipTests/Pods-DipTests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0990225B1BC123C000E76F43 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@@ -533,7 +400,6 @@
|
||||
/* Begin XCBuildConfiguration section */
|
||||
0990226F1BC123C000E76F43 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 6AB71DAFECF410F2FB12A44C /* Pods-DipSampleApp.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -549,7 +415,6 @@
|
||||
};
|
||||
099022701BC123C000E76F43 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = B16085421B606723B72DE694 /* Pods-DipSampleApp.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = DipSampleApp/Info.plist;
|
||||
@@ -645,7 +510,6 @@
|
||||
};
|
||||
607FACF31AFB9204008FA782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7E5EDFB4A9194B50CAED7E1A /* Pods-DipTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@@ -660,7 +524,6 @@
|
||||
};
|
||||
607FACF41AFB9204008FA782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D9BBF14E74848332935F75C4 /* Pods-DipTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
@@ -681,7 +544,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Dip" */ = {
|
||||
607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DipSampleApp" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
607FACED1AFB9204008FA782 /* Debug */,
|
||||
@@ -690,7 +553,7 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DipTests" */ = {
|
||||
607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "DipSampleAppTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
607FACF31AFB9204008FA782 /* Debug */,
|
||||
@@ -17,7 +17,7 @@
|
||||
BlueprintIdentifier = "0990225E1BC123C000E76F43"
|
||||
BuildableName = "DipSampleApp.app"
|
||||
BlueprintName = "DipSampleApp"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
@@ -29,9 +29,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "DipTests.xctest"
|
||||
BlueprintName = "DipTests"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
BuildableName = "DipSampleAppTests.xctest"
|
||||
BlueprintName = "DipSampleAppTests"
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -48,9 +48,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "DipTests.xctest"
|
||||
BlueprintName = "DipTests"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
BuildableName = "DipSampleAppTests.xctest"
|
||||
BlueprintName = "DipSampleAppTests"
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
@@ -60,7 +60,7 @@
|
||||
BlueprintIdentifier = "0990225E1BC123C000E76F43"
|
||||
BuildableName = "DipSampleApp.app"
|
||||
BlueprintName = "DipSampleApp"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -83,7 +83,7 @@
|
||||
BlueprintIdentifier = "0990225E1BC123C000E76F43"
|
||||
BuildableName = "DipSampleApp.app"
|
||||
BlueprintName = "DipSampleApp"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
@@ -102,7 +102,7 @@
|
||||
BlueprintIdentifier = "0990225E1BC123C000E76F43"
|
||||
BuildableName = "DipSampleApp.app"
|
||||
BlueprintName = "DipSampleApp"
|
||||
ReferencedContainer = "container:Dip.xcodeproj">
|
||||
ReferencedContainer = "container:DipSampleApp.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 277 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -22,7 +22,7 @@ private let FAKE_STARSHIPS = false
|
||||
let wsDependencies = DependencyContainer() { dip in
|
||||
|
||||
// Register the NetworkLayer, same for everyone here (but we have the ability to register a different one for a specific WebService if we wanted to)
|
||||
dip.register(instance: URLSessionNetworkLayer(baseURL: "http://swapi.co/api/")! as NetworkLayer)
|
||||
dip.register(.Singleton) { URLSessionNetworkLayer(baseURL: "http://swapi.co/api/")! as NetworkLayer }
|
||||
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ let providerDependencies = DependencyContainer() { dip in
|
||||
if FAKE_PERSONS {
|
||||
|
||||
// 1) Register the PersonProviderAPI singleton, one generic and one specific for a specific personID
|
||||
dip.register(instance: DummyPilotProvider() as PersonProviderAPI)
|
||||
dip.register(0, instance: PlistPersonProvider(plist: "mainPilot") as PersonProviderAPI)
|
||||
dip.register(.Singleton) { DummyPilotProvider() as PersonProviderAPI }
|
||||
dip.register(tag: 0, .Singleton) { PlistPersonProvider(plist: "mainPilot") as PersonProviderAPI }
|
||||
|
||||
} else {
|
||||
|
||||
// 1) Register the SWAPIPersonProvider (that hits the real swapi.co WebService)
|
||||
dip.register(instance: SWAPIPersonProvider() as PersonProviderAPI)
|
||||
dip.register(.Singleton) { SWAPIPersonProvider() as PersonProviderAPI }
|
||||
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ let providerDependencies = DependencyContainer() { dip in
|
||||
|
||||
// 2) Register the StarshipProviderAPI factories, one generic and one specific for a specific starshipID
|
||||
dip.register() { HardCodedStarshipProvider() as StarshipProviderAPI }
|
||||
dip.register(0) { DummyStarshipProvider(pilotName: "Main Pilot") as StarshipProviderAPI }
|
||||
dip.register(tag: 0) { DummyStarshipProvider(pilotName: "Main Pilot") as StarshipProviderAPI }
|
||||
|
||||
} else {
|
||||
|
||||
// 2) Register the SWAPIStarshipProvider (that hits the real swapi.co WebService)
|
||||
dip.register(instance: SWAPIStarshipProvider() as StarshipProviderAPI)
|
||||
dip.register(.Singleton) { SWAPIStarshipProvider() as StarshipProviderAPI }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Nnt-Mi-Wf8">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Nnt-Mi-Wf8">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||