├── .gitignore
├── .ruby-version
├── .swift-version
├── Gemfile
├── Gemfile.lock
├── LICENSE
├── Podfile
├── Podfile.lock
├── README.md
├── Resources
├── Info.plist
└── SwiftResolver.h
├── Sources
├── Atomic.swift
├── Container.swift
├── ContainerError.swift
├── DependencyPool.swift
├── Factory.swift
├── FactoryType.swift
├── InstancePool.swift
├── String+Helpers.swift
└── TypeSpecifier.swift
├── SwiftResolver.playground
├── Contents.swift
└── contents.xcplayground
├── SwiftResolver.podspec
├── SwiftResolver.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── SwiftResolver.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── SwiftResolverTests
├── ContainerFactory.swift
├── ContainerTests.swift
└── Info.plist
└── tutorial
└── Example1
├── .gitignore
├── Example1.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── Example1.xcworkspace
└── contents.xcworkspacedata
├── Example1
├── Assets
│ ├── Assets.xcassets
│ │ └── Contents.json
│ ├── Base.lproj
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
└── Classes
│ ├── AppContainer.swift
│ ├── AppDelegate.swift
│ ├── Home
│ └── GithubViewController.swift
│ ├── Model
│ └── GithubRepositoryInformation.swift
│ ├── Repository
│ ├── AuthenticationRepository.swift
│ └── GithubRepository.swift
│ └── RequestProvider
│ ├── DataError.swift
│ ├── Future.swift
│ ├── GithubTarget.swift
│ ├── RequestProvider.swift
│ ├── Result.swift
│ └── Scheduler.swift
├── Example1Tests
├── Info.plist
└── WhyTests.swift
├── Podfile
├── Podfile.lock
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | #
2 | # https://github.com/github/gitignore/blob/master/Swift.gitignore
3 | #
4 |
5 | ## Build generated
6 | build/
7 | DerivedData
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata
19 |
20 | ## Other
21 | *.xccheckout
22 | *.moved-aside
23 | *.xcuserstate
24 | *.xcscmblueprint
25 |
26 | ## Obj-C/Swift specific
27 | *.hmap
28 | *.ipa
29 |
30 | ## Playgrounds
31 | timeline.xctimeline
32 | playground.xcworkspace
33 |
34 | # Swift Package Manager
35 | #
36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
37 | Packages/
38 | .build/
39 |
40 | # CocoaPods
41 | #
42 | # We recommend against adding the Pods directory to your .gitignore. However
43 | # you should judge for yourself, the pros and cons are mentioned at:
44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
45 | #
46 | Pods/
47 |
48 | # Carthage
49 | #
50 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
51 | # Carthage/Checkouts
52 | #
53 | # Carthage/Build
54 |
55 | # fastlane
56 | #
57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
58 | # screenshots whenever they are needed.
59 | # For more information about the recommended setup visit:
60 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
61 |
62 | fastlane/report.xml
63 | fastlane/screenshots
64 |
65 | ## Mac
66 | .DS_Store
67 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 2.3.3
2 |
--------------------------------------------------------------------------------
/.swift-version:
--------------------------------------------------------------------------------
1 | 4.0
2 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | ruby '2.3.3'
4 |
5 | gem 'bundler'
6 | gem 'cocoapods'
7 | gem 'fourflusher', git: 'https://github.com/CocoaPods/fourflusher', branch: 'master'
8 |
9 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: https://github.com/CocoaPods/fourflusher
3 | revision: 8235ee8fae34ccaf5c708987306228988cea2e43
4 | branch: master
5 | specs:
6 | fourflusher (2.2.0)
7 |
8 | GEM
9 | remote: https://rubygems.org/
10 | specs:
11 | CFPropertyList (3.0.0)
12 | activesupport (4.2.11.1)
13 | i18n (~> 0.7)
14 | minitest (~> 5.1)
15 | thread_safe (~> 0.3, >= 0.3.4)
16 | tzinfo (~> 1.1)
17 | atomos (0.1.3)
18 | claide (1.0.2)
19 | cocoapods (1.6.1)
20 | activesupport (>= 4.0.2, < 5)
21 | claide (>= 1.0.2, < 2.0)
22 | cocoapods-core (= 1.6.1)
23 | cocoapods-deintegrate (>= 1.0.2, < 2.0)
24 | cocoapods-downloader (>= 1.2.2, < 2.0)
25 | cocoapods-plugins (>= 1.0.0, < 2.0)
26 | cocoapods-search (>= 1.0.0, < 2.0)
27 | cocoapods-stats (>= 1.0.0, < 2.0)
28 | cocoapods-trunk (>= 1.3.1, < 2.0)
29 | cocoapods-try (>= 1.1.0, < 2.0)
30 | colored2 (~> 3.1)
31 | escape (~> 0.0.4)
32 | fourflusher (>= 2.2.0, < 3.0)
33 | gh_inspector (~> 1.0)
34 | molinillo (~> 0.6.6)
35 | nap (~> 1.0)
36 | ruby-macho (~> 1.4)
37 | xcodeproj (>= 1.8.1, < 2.0)
38 | cocoapods-core (1.6.1)
39 | activesupport (>= 4.0.2, < 6)
40 | fuzzy_match (~> 2.0.4)
41 | nap (~> 1.0)
42 | cocoapods-deintegrate (1.0.4)
43 | cocoapods-downloader (1.2.2)
44 | cocoapods-plugins (1.0.0)
45 | nap
46 | cocoapods-search (1.0.0)
47 | cocoapods-stats (1.1.0)
48 | cocoapods-trunk (1.3.1)
49 | nap (>= 0.8, < 2.0)
50 | netrc (~> 0.11)
51 | cocoapods-try (1.1.0)
52 | colored2 (3.1.2)
53 | concurrent-ruby (1.1.5)
54 | escape (0.0.4)
55 | fuzzy_match (2.0.4)
56 | gh_inspector (1.1.3)
57 | i18n (0.9.5)
58 | concurrent-ruby (~> 1.0)
59 | minitest (5.11.3)
60 | molinillo (0.6.6)
61 | nanaimo (0.2.6)
62 | nap (1.1.0)
63 | netrc (0.11.0)
64 | ruby-macho (1.4.0)
65 | thread_safe (0.3.6)
66 | tzinfo (1.2.5)
67 | thread_safe (~> 0.1)
68 | xcodeproj (1.8.2)
69 | CFPropertyList (>= 2.3.3, < 4.0)
70 | atomos (~> 0.1.3)
71 | claide (>= 1.0.2, < 2.0)
72 | colored2 (~> 3.1)
73 | nanaimo (~> 0.2.6)
74 |
75 | PLATFORMS
76 | ruby
77 |
78 | DEPENDENCIES
79 | bundler
80 | cocoapods
81 | fourflusher!
82 |
83 | RUBY VERSION
84 | ruby 2.3.3p222
85 |
86 | BUNDLED WITH
87 | 1.16.5
88 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 99
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, '8.0'
3 |
4 | target 'SwiftResolver' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 | inhibit_all_warnings!
8 |
9 | target 'SwiftResolverTests' do
10 | inherit! :search_paths
11 | pod 'Quick'
12 | pod 'Nimble'
13 | end
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Nimble (8.0.1)
3 | - Quick (2.0.0)
4 |
5 | DEPENDENCIES:
6 | - Nimble
7 | - Quick
8 |
9 | SPEC CHECKSUMS:
10 | Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0
11 | Quick: ce1276c7c27ba2da3cb2fd0cde053c3648b3b22d
12 |
13 | PODFILE CHECKSUM: 9381a1db6b8d60326a352bec7191252c36f4ba5f
14 |
15 | COCOAPODS: 1.4.0
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SwiftResolver
2 | Dependency injection framework for Swift.
3 |
4 | ## Usage
5 | ```swift
6 | container.register { MyService() as Service }
7 | ...
8 | let service: Service = container.resolve()
9 | ```
10 |
11 | You can find more detailed use cases in the [wiki](https://github.com/viniciusaro/SwiftResolver/wiki) page
12 |
13 | ## Instalation
14 | ```ruby
15 | pod 'SwiftResolver'
16 | ```
17 |
18 | ## Multiple Implementations of same Protocol
19 |
20 | You can register multiple implementations of the same protocol in the same container.
21 | Later, when resolving, the specific type of the implementation can be passed as parameter to obtain the correct implementation type.
22 |
23 | ```swift
24 | container.register(MyService.init).as(ServiceProtocol.self)
25 | container.register(OtherService.init).as(ServiceProtocol.self)
26 | ...
27 | let service: ServiceProtocol = container.resolve(MyService.self) // instance of MyService is returned here
28 | ```
29 |
30 | ## Multiple Configurations
31 |
32 | You can register multiple implementations of the same object with different configurations.
33 | Later, when resolving, an identifier of the implementation can be passed as parameter to obtain the instance with the correct configuration.
34 |
35 | ```swift
36 | enum MyServices: String {
37 | case mock
38 | case live
39 | }
40 |
41 | container.register { MyService(requestProvider: liveRequestProvider) as Service }.tag(MyServices.live)
42 | container.register { MyService(requestProvider: mockRequestProvider) as Service }.tag(MyServices.mock)
43 | ...
44 | let service: Service = container.resolve(MyServices.live)
45 | ```
46 |
47 | ## Thread Safety
48 |
49 | SwiftResolver is thread safe. This means you can register/resolve in different threads.
50 |
51 | However, this is not a good practice since resolving instances that are not registered yet results in a `fatalError`.
52 |
53 | It is recommended to use an AppContainer as described in the [wiki](https://github.com/viniciusaro/SwiftResolver/wiki/Project-Setup) page for a one time registration process.
54 |
55 | ## References
56 | * [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection)
57 | * [Dip](https://github.com/AliSoftware/Dip)
58 |
--------------------------------------------------------------------------------
/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.7
19 | CFBundleVersion
20 | 0
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Resources/SwiftResolver.h:
--------------------------------------------------------------------------------
1 | //
2 | // Resolver.h
3 | // Resolver
4 | //
5 | // Created by Vinicius on 15/06/17.
6 | // Copyright © 2017 99. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for Resolver.
12 | FOUNDATION_EXPORT double SwiftResolverVersionNumber;
13 |
14 | //! Project version string for Resolver.
15 | FOUNDATION_EXPORT const unsigned char SwiftResolverVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Sources/Atomic.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | final class Atomic {
4 | private var _value: T
5 | private let queue = DispatchQueue(label: "SwiftResolver.Atomic.Serial.Queue")
6 |
7 | var value: T {
8 | return self.queue.sync { self._value }
9 | }
10 |
11 | func mutate(_ transform: (inout T) -> Void) {
12 | _ = self.queue.sync { transform(&self._value) }
13 | }
14 |
15 | init(_ value: T) {
16 | self._value = value
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Sources/Container.swift:
--------------------------------------------------------------------------------
1 | public enum Scope {
2 | case instance
3 | case singleton
4 | case shared
5 | }
6 |
7 | final public class Container {
8 | public typealias Builder0 = (()) -> T
9 | public typealias Builder1 = (A) -> T
10 | public typealias Builder2 = ((A, B)) -> T
11 | public typealias Builder3 = ((A, B, C)) -> T
12 | public typealias Builder4 = ((A, B, C, D)) -> T
13 | public typealias Builder5 = ((A, B, C, D, E)) -> T
14 |
15 | private let pool = DependencyPool()
16 |
17 | public init() {}
18 |
19 | @discardableResult
20 | public func register(scope: Scope = .instance, _ builder: @escaping Builder0) -> TypeSpecifier {
21 | let factory = Factory(scope: scope) {
22 | builder(())
23 | }
24 | return self.pool.register(factory)
25 | }
26 |
27 | @discardableResult
28 | public func register(scope: Scope = .instance, _ builder: @escaping Builder1) -> TypeSpecifier {
29 | let factory = Factory(scope: scope) { [unowned self] in
30 | return try builder((self.pool.instance()))
31 | }
32 | return self.pool.register(factory)
33 | }
34 |
35 | @discardableResult
36 | public func register(scope: Scope = .instance, _ builder: @escaping Builder2) -> TypeSpecifier {
37 | let factory = Factory(scope: scope) { [unowned self] in
38 | return try builder((self.pool.instance(),
39 | self.pool.instance()))
40 | }
41 | return self.pool.register(factory)
42 | }
43 |
44 | @discardableResult
45 | public func register(scope: Scope = .instance, _ builder: @escaping Builder3) -> TypeSpecifier {
46 | let factory = Factory(scope: scope) { [unowned self] in
47 | return try builder((self.pool.instance(),
48 | self.pool.instance(),
49 | self.pool.instance()))
50 | }
51 | return self.pool.register(factory)
52 | }
53 |
54 | @discardableResult
55 | public func register(scope: Scope = .instance, _ builder: @escaping Builder4) -> TypeSpecifier {
56 | let factory = Factory(scope: scope) { [unowned self] in
57 | return try builder((self.pool.instance(),
58 | self.pool.instance(),
59 | self.pool.instance(),
60 | self.pool.instance()))
61 | }
62 | return self.pool.register(factory)
63 | }
64 |
65 | @discardableResult
66 | public func register(scope: Scope = .instance, _ builder: @escaping Builder5) -> TypeSpecifier {
67 | let factory = Factory(scope: scope) { [unowned self] in
68 | return try builder((self.pool.instance(),
69 | self.pool.instance(),
70 | self.pool.instance(),
71 | self.pool.instance(),
72 | self.pool.instance()))
73 | }
74 | return self.pool.register(factory)
75 | }
76 |
77 | public func resolve() -> T {
78 | return self.resolve { try self.pool.instance() }
79 | }
80 |
81 | public func resolve(_ specificType: Specifier) -> T {
82 | return self.resolve { try self.pool.instance(specificType) }
83 | }
84 |
85 | public func resolve(_ tag: String) -> T {
86 | return self.resolve { try self.pool.instance(tag: tag) }
87 | }
88 |
89 | public func resolve(_ tag: StringRepresentable) -> T where StringRepresentable.RawValue == String {
90 | return self.resolve { try self.pool.instance(tag: tag.rawValue) }
91 | }
92 |
93 | private func resolve(_ resolverMethod: () throws -> T) -> T {
94 | do {
95 | self.pool.clearShared()
96 | let instance = try resolverMethod() as T
97 | return instance
98 | } catch let error as ContainerError {
99 | fatalError(error.localizedDescription)
100 | } catch {
101 | fatalError("Unregistered type \(T.self)")
102 | }
103 | }
104 |
105 | public func instanceCountFor(_ type: T.Type) -> Int {
106 | return self.pool.instanceCountFor(type: T.self)
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Sources/ContainerError.swift:
--------------------------------------------------------------------------------
1 | enum ContainerError: Swift.Error {
2 | case unregisteredValue(T.Type)
3 |
4 | var localizedDescription: String {
5 | switch self {
6 | case let .unregisteredValue(type): return "Unregistered type \(type)"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Sources/DependencyPool.swift:
--------------------------------------------------------------------------------
1 | final class DependencyPool {
2 | private var factories: Atomic<[String: AnyFactory]> = Atomic([:])
3 | private var sharedInstances = InstancePool()
4 | private var singletonInstances = InstancePool()
5 |
6 | func clearShared() {
7 | self.sharedInstances.clear()
8 | }
9 |
10 | func instanceCountFor(type: T.Type) -> Int {
11 | let identifier = String(describing: T.self)
12 | guard let factory = self.factories.value[identifier] else {
13 | return 0
14 | }
15 | return factory.instanceCount
16 | }
17 | }
18 |
19 | extension DependencyPool {
20 | func register(_ factory: Factory) -> TypeSpecifier {
21 | self.internalRegister(factory)
22 |
23 | return TypeSpecifier(onRegister: { identifier in
24 | self.internalRegister(factory, specificIdentifier: identifier)
25 | })
26 | }
27 |
28 | private func internalRegister(_ factory: Factory, specificIdentifier: String = "") {
29 | let elementTypeIdentifier = String(describing: Factory.Element.self).withoutTypeExtension
30 | let typeSpecificIdentifier = specificIdentifier.withoutTypeExtension
31 | let identifier = elementTypeIdentifier + typeSpecificIdentifier
32 |
33 | self.factories.mutate { $0[identifier] = factory.asAny() }
34 | if typeSpecificIdentifier.count > 0 {
35 | self.factories.mutate { $0[typeSpecificIdentifier] = factory.asAny() }
36 | }
37 | }
38 | }
39 |
40 | extension DependencyPool {
41 | func instance() throws -> T {
42 | let identifier = String(describing: T.self).withoutTypeExtension
43 | return try self.instance(identifier: identifier)
44 | }
45 |
46 | func instance(tag: String) throws -> T {
47 | let elementType = String(describing: T.self).withoutTypeExtension
48 | let identifier = elementType + tag
49 | return try self.instance(identifier: identifier)
50 | }
51 |
52 | func instance(_ elementType: ImplementationType) throws -> GenericType {
53 | let elementTypeIdentifier = String(describing: ImplementationType.self).withoutTypeExtension
54 | let typeSpecificIdentifier = String(describing: GenericType.self).withoutTypeExtension
55 | let identifier = elementTypeIdentifier + typeSpecificIdentifier
56 | return try self.instance(identifier: identifier)
57 | }
58 |
59 | private func instance(identifier: String) throws -> T {
60 | guard let factory = self.factories.value[identifier] else {
61 | throw ContainerError.unregisteredValue(T.self)
62 | }
63 |
64 | switch factory.scope {
65 | case .instance: return try self.buildInstance(with: factory)
66 | case .shared: return try self.buildSharedInstance(with: factory)
67 | case .singleton: return try self.buildSingletonInstance(with: factory)
68 | }
69 | }
70 | }
71 |
72 | extension DependencyPool {
73 | private func buildInstance(with factory: AnyFactory) throws -> T {
74 | guard let element = try factory.build() as? T else {
75 | throw ContainerError.unregisteredValue(T.self)
76 | }
77 | return element
78 | }
79 |
80 | private func buildSharedInstance(with factory: AnyFactory) throws -> T {
81 | if let element: T = self.sharedInstances.get() {
82 | return element
83 | }
84 | guard let element = try factory.build() as? T else {
85 | throw ContainerError.unregisteredValue(T.self)
86 | }
87 | self.sharedInstances.register(instance: element)
88 | return element
89 | }
90 |
91 | private func buildSingletonInstance(with factory: AnyFactory) throws -> T {
92 | if let element: T = self.singletonInstances.get() {
93 | return element
94 | }
95 | guard let element = try factory.build() as? T else {
96 | throw ContainerError.unregisteredValue(T.self)
97 | }
98 | self.singletonInstances.register(instance: element)
99 | return element
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Sources/Factory.swift:
--------------------------------------------------------------------------------
1 | final class Factory: FactoryType {
2 | typealias Builder = () throws -> T
3 |
4 | let scope: Scope
5 | private let builder: Builder
6 | private(set) var instanceCount = 0
7 |
8 | init(scope: Scope, builder: @escaping Builder) {
9 | self.scope = scope
10 | self.builder = builder
11 | }
12 |
13 | func build() throws -> T {
14 | self.instanceCount += 1
15 | return try self.builder()
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Sources/FactoryType.swift:
--------------------------------------------------------------------------------
1 | protocol FactoryType {
2 | associatedtype Element
3 | var scope: Scope { get }
4 | var instanceCount: Int { get }
5 | func build() throws -> Element
6 | }
7 |
8 | extension FactoryType {
9 | func asAny() -> AnyFactory {
10 | return AnyFactory(factory: self)
11 | }
12 | }
13 |
14 | final class AnyFactory: FactoryType {
15 | let scope: Scope
16 | private let buildClosure: () throws -> Any
17 | private let instanceCountClosure: () -> Int
18 |
19 | var instanceCount: Int {
20 | return self.instanceCountClosure()
21 | }
22 |
23 | init(factory: Factory) {
24 | self.buildClosure = factory.build
25 | self.instanceCountClosure = { factory.instanceCount }
26 | self.scope = factory.scope
27 | }
28 |
29 | func build() throws -> Any {
30 | return try self.buildClosure()
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Sources/InstancePool.swift:
--------------------------------------------------------------------------------
1 | final class InstancePool {
2 | private var instances: Atomic<[String: Any]> = Atomic([:])
3 |
4 | init() {}
5 |
6 | func register(instance: T) {
7 | let identifier = String(describing: T.self)
8 | self.instances.mutate { $0[identifier] = instance }
9 | }
10 |
11 | func get() -> T? {
12 | let identifier = String(describing: T.self)
13 | return self.instances.value[identifier] as? T
14 | }
15 |
16 | func clear() {
17 | self.instances.mutate { $0.removeAll() }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Sources/String+Helpers.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | extension String {
4 | var withoutTypeExtension: String {
5 | let string = self.split(separator: ".").first ?? ""
6 | return String(string)
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Sources/TypeSpecifier.swift:
--------------------------------------------------------------------------------
1 | final public class TypeSpecifier {
2 | private let onRegister: (String) -> Void
3 |
4 | init(onRegister: @escaping (String) -> Void) {
5 | self.onRegister = onRegister
6 | }
7 |
8 | public func `as`(_ type: T) {
9 | self.onRegister(String(describing: T.self))
10 | }
11 |
12 | public func tag(_ tag: String) {
13 | self.onRegister(tag)
14 | }
15 |
16 | public func tag(_ tag: StringRepresentable) where StringRepresentable.RawValue == String {
17 | self.onRegister(tag.rawValue)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/SwiftResolver.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import SwiftResolver
2 |
3 | protocol Human {
4 |
5 | }
6 |
7 | final class Child {}
8 |
9 | final class Father: Human {
10 | let child: Child
11 | init(child: Child) {
12 | self.child = child
13 | }
14 | }
15 |
16 | final class Mother: Human {
17 | let child: Child
18 | init(child: Child) {
19 | self.child = child
20 | }
21 | }
22 |
23 | final class Family {
24 | let father: Father
25 | let mother: Mother
26 | let child: Child
27 | init(father: Father, mother: Mother, child: Child) {
28 | self.father = father
29 | self.mother = mother
30 | self.child = child
31 | }
32 | }
33 |
34 | let container = Container()
35 |
36 | container.register(scope: .shared) { Child() }
37 | container.register { Father(child: $0) }.as(Human.self)
38 | container.register { Mother(child: $0) }.as(Human.self)
39 | container.register { Family(father: $0, mother: $1, child: $2) }
40 |
41 | let father = container.resolve() as Father
42 | let human: Human = container.resolve(Mother.self)
43 |
44 | let family = container.resolve() as Family
45 | family.father.child === family.child
46 | family.mother.child === family.child
47 | family.mother.child === family.father.child
48 |
49 | let family2 = container.resolve() as Family
50 | family.child === family2.child
51 |
52 |
--------------------------------------------------------------------------------
/SwiftResolver.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SwiftResolver.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "SwiftResolver"
3 | s.version = "1.0.11"
4 | s.summary = "Dependency injection framework for Swift."
5 |
6 | s.description = <<-DESC
7 | The dependency injection pattern helps your app split into loosely-coupled components,
8 | which can be developed, tested and maintained more easily. SwiftResolver helps you
9 | achieve that in an organized way.
10 | DESC
11 |
12 | s.homepage = "https://github.com/viniciusaro/SwiftResolver"
13 | s.license = 'MIT'
14 | s.authors = { "Vinicius Rodrigues" => "vinicius.a.ro@gmail.com" }
15 | s.source = { :git => "https://github.com/viniciusaro/SwiftResolver.git", :tag => s.version.to_s }
16 | s.social_media_url = 'https://twitter.com/vinizzera'
17 |
18 | s.ios.deployment_target = '8.0'
19 | s.osx.deployment_target = '10.9'
20 | s.tvos.deployment_target = '9.0'
21 | s.watchos.deployment_target = '2.0'
22 |
23 | s.requires_arc = true
24 |
25 | s.source_files = 'Sources/**/*.swift'
26 | end
--------------------------------------------------------------------------------
/SwiftResolver.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5999A1BD666812057B6E2827 /* Pods_SwiftResolverTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEB58DF8DAA83C3C88139B88 /* Pods_SwiftResolverTests.framework */; };
11 | 636820292034BA6100532132 /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636820282034BA6100532132 /* Atomic.swift */; };
12 | 63B2D781200D0C36001E5AB8 /* String+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B2D780200D0C36001E5AB8 /* String+Helpers.swift */; };
13 | 63B2D783200D16FA001E5AB8 /* TypeSpecifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B2D782200D16FA001E5AB8 /* TypeSpecifier.swift */; };
14 | 811CFA841F0352FC005521A7 /* ContainerFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811CFA811F0352FC005521A7 /* ContainerFactory.swift */; };
15 | 811CFA851F0352FC005521A7 /* ContainerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811CFA821F0352FC005521A7 /* ContainerTests.swift */; };
16 | 818B1ECC1EF2D4E8005F4434 /* SwiftResolver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 818B1EC21EF2D4E8005F4434 /* SwiftResolver.framework */; };
17 | 818B1EE01EF2D5B4005F4434 /* SwiftResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 818B1EDF1EF2D58B005F4434 /* SwiftResolver.h */; settings = {ATTRIBUTES = (Public, ); }; };
18 | 818B1EF81EF2E2FA005F4434 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EF21EF2D5F0005F4434 /* Container.swift */; };
19 | 818B1EF91EF2E2FA005F4434 /* ContainerError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EF31EF2D5F0005F4434 /* ContainerError.swift */; };
20 | 818B1EFA1EF2E2FA005F4434 /* DependencyPool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EEF1EF2D5F0005F4434 /* DependencyPool.swift */; };
21 | 818B1EFB1EF2E2FA005F4434 /* Factory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EF11EF2D5F0005F4434 /* Factory.swift */; };
22 | 818B1EFC1EF2E2FA005F4434 /* FactoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EF41EF2D5F0005F4434 /* FactoryType.swift */; };
23 | 818B1EFD1EF2E2FA005F4434 /* InstancePool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818B1EF01EF2D5F0005F4434 /* InstancePool.swift */; };
24 | 9C8D3D3A96185A09C0DFC26A /* Pods_SwiftResolver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 597E339A77FA2AE5407B7FBD /* Pods_SwiftResolver.framework */; };
25 | /* End PBXBuildFile section */
26 |
27 | /* Begin PBXContainerItemProxy section */
28 | 818B1ECD1EF2D4E8005F4434 /* PBXContainerItemProxy */ = {
29 | isa = PBXContainerItemProxy;
30 | containerPortal = 818B1EB91EF2D4E8005F4434 /* Project object */;
31 | proxyType = 1;
32 | remoteGlobalIDString = 818B1EC11EF2D4E8005F4434;
33 | remoteInfo = Resolver;
34 | };
35 | /* End PBXContainerItemProxy section */
36 |
37 | /* Begin PBXFileReference section */
38 | 03345C50C145B8A58A0FFC51 /* Pods_Resolver.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Resolver.framework; sourceTree = BUILT_PRODUCTS_DIR; };
39 | 0C68E75748576DF3EE8ABBD9 /* Pods-SwiftResolverTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftResolverTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftResolverTests/Pods-SwiftResolverTests.release.xcconfig"; sourceTree = ""; };
40 | 2A7C3056E7F2D9B752452ADA /* Pods-Resolver.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Resolver.release.xcconfig"; path = "Pods/Target Support Files/Pods-Resolver/Pods-Resolver.release.xcconfig"; sourceTree = ""; };
41 | 2E00CD1739740848F7746922 /* Pods-ResolverTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ResolverTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ResolverTests/Pods-ResolverTests.debug.xcconfig"; sourceTree = ""; };
42 | 597E339A77FA2AE5407B7FBD /* Pods_SwiftResolver.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftResolver.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 636820282034BA6100532132 /* Atomic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Atomic.swift; sourceTree = ""; };
44 | 63B2D780200D0C36001E5AB8 /* String+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Helpers.swift"; sourceTree = ""; };
45 | 63B2D782200D16FA001E5AB8 /* TypeSpecifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeSpecifier.swift; sourceTree = ""; };
46 | 7CC65F404B89B5AD2378C71F /* Pods-SwiftResolver.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftResolver.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftResolver/Pods-SwiftResolver.debug.xcconfig"; sourceTree = ""; };
47 | 811CFA811F0352FC005521A7 /* ContainerFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerFactory.swift; sourceTree = ""; };
48 | 811CFA821F0352FC005521A7 /* ContainerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerTests.swift; sourceTree = ""; };
49 | 811CFA831F0352FC005521A7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
50 | 818B1EC21EF2D4E8005F4434 /* SwiftResolver.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftResolver.framework; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 818B1ECB1EF2D4E8005F4434 /* SwiftResolverTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftResolverTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
52 | 818B1EDE1EF2D58B005F4434 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
53 | 818B1EDF1EF2D58B005F4434 /* SwiftResolver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftResolver.h; sourceTree = ""; };
54 | 818B1EEF1EF2D5F0005F4434 /* DependencyPool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyPool.swift; sourceTree = ""; };
55 | 818B1EF01EF2D5F0005F4434 /* InstancePool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstancePool.swift; sourceTree = ""; };
56 | 818B1EF11EF2D5F0005F4434 /* Factory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Factory.swift; sourceTree = ""; };
57 | 818B1EF21EF2D5F0005F4434 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; };
58 | 818B1EF31EF2D5F0005F4434 /* ContainerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerError.swift; sourceTree = ""; };
59 | 818B1EF41EF2D5F0005F4434 /* FactoryType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FactoryType.swift; sourceTree = ""; };
60 | 846DCFD110D2B4FF3CC857EE /* Pods-SwiftResolverTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftResolverTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftResolverTests/Pods-SwiftResolverTests.debug.xcconfig"; sourceTree = ""; };
61 | A13AA300353B8ED04CD3DB0A /* Pods_ResolverTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ResolverTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
62 | AE1EC9E52477912A25EBAA5C /* Pods-SwiftResolver.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftResolver.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftResolver/Pods-SwiftResolver.release.xcconfig"; sourceTree = ""; };
63 | BEB58DF8DAA83C3C88139B88 /* Pods_SwiftResolverTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftResolverTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
64 | D085637B3AFB516AFBBCCC18 /* Pods-Resolver.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Resolver.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Resolver/Pods-Resolver.debug.xcconfig"; sourceTree = ""; };
65 | FC62188B1B362F4EEC446949 /* Pods-ResolverTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ResolverTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ResolverTests/Pods-ResolverTests.release.xcconfig"; sourceTree = ""; };
66 | /* End PBXFileReference section */
67 |
68 | /* Begin PBXFrameworksBuildPhase section */
69 | 818B1EBE1EF2D4E8005F4434 /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | 9C8D3D3A96185A09C0DFC26A /* Pods_SwiftResolver.framework in Frameworks */,
74 | );
75 | runOnlyForDeploymentPostprocessing = 0;
76 | };
77 | 818B1EC81EF2D4E8005F4434 /* Frameworks */ = {
78 | isa = PBXFrameworksBuildPhase;
79 | buildActionMask = 2147483647;
80 | files = (
81 | 818B1ECC1EF2D4E8005F4434 /* SwiftResolver.framework in Frameworks */,
82 | 5999A1BD666812057B6E2827 /* Pods_SwiftResolverTests.framework in Frameworks */,
83 | );
84 | runOnlyForDeploymentPostprocessing = 0;
85 | };
86 | /* End PBXFrameworksBuildPhase section */
87 |
88 | /* Begin PBXGroup section */
89 | 811CFA801F0352FC005521A7 /* SwiftResolverTests */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 811CFA811F0352FC005521A7 /* ContainerFactory.swift */,
93 | 811CFA821F0352FC005521A7 /* ContainerTests.swift */,
94 | 811CFA831F0352FC005521A7 /* Info.plist */,
95 | );
96 | path = SwiftResolverTests;
97 | sourceTree = "";
98 | };
99 | 818B1EB81EF2D4E8005F4434 = {
100 | isa = PBXGroup;
101 | children = (
102 | 818B1EDD1EF2D58B005F4434 /* Resources */,
103 | 818B1EDC1EF2D58B005F4434 /* Sources */,
104 | 811CFA801F0352FC005521A7 /* SwiftResolverTests */,
105 | A590733809B5EA4955B123DB /* Frameworks */,
106 | 8E336B9179BD3B603464F28A /* Pods */,
107 | 818B1EC31EF2D4E8005F4434 /* Products */,
108 | );
109 | sourceTree = "";
110 | };
111 | 818B1EC31EF2D4E8005F4434 /* Products */ = {
112 | isa = PBXGroup;
113 | children = (
114 | 818B1EC21EF2D4E8005F4434 /* SwiftResolver.framework */,
115 | 818B1ECB1EF2D4E8005F4434 /* SwiftResolverTests.xctest */,
116 | );
117 | name = Products;
118 | sourceTree = "";
119 | };
120 | 818B1EDC1EF2D58B005F4434 /* Sources */ = {
121 | isa = PBXGroup;
122 | children = (
123 | 636820282034BA6100532132 /* Atomic.swift */,
124 | 818B1EF21EF2D5F0005F4434 /* Container.swift */,
125 | 818B1EF31EF2D5F0005F4434 /* ContainerError.swift */,
126 | 818B1EEF1EF2D5F0005F4434 /* DependencyPool.swift */,
127 | 818B1EF11EF2D5F0005F4434 /* Factory.swift */,
128 | 818B1EF41EF2D5F0005F4434 /* FactoryType.swift */,
129 | 818B1EF01EF2D5F0005F4434 /* InstancePool.swift */,
130 | 63B2D780200D0C36001E5AB8 /* String+Helpers.swift */,
131 | 63B2D782200D16FA001E5AB8 /* TypeSpecifier.swift */,
132 | );
133 | path = Sources;
134 | sourceTree = "";
135 | };
136 | 818B1EDD1EF2D58B005F4434 /* Resources */ = {
137 | isa = PBXGroup;
138 | children = (
139 | 818B1EDE1EF2D58B005F4434 /* Info.plist */,
140 | 818B1EDF1EF2D58B005F4434 /* SwiftResolver.h */,
141 | );
142 | path = Resources;
143 | sourceTree = "";
144 | };
145 | 8E336B9179BD3B603464F28A /* Pods */ = {
146 | isa = PBXGroup;
147 | children = (
148 | D085637B3AFB516AFBBCCC18 /* Pods-Resolver.debug.xcconfig */,
149 | 2A7C3056E7F2D9B752452ADA /* Pods-Resolver.release.xcconfig */,
150 | 2E00CD1739740848F7746922 /* Pods-ResolverTests.debug.xcconfig */,
151 | FC62188B1B362F4EEC446949 /* Pods-ResolverTests.release.xcconfig */,
152 | 7CC65F404B89B5AD2378C71F /* Pods-SwiftResolver.debug.xcconfig */,
153 | AE1EC9E52477912A25EBAA5C /* Pods-SwiftResolver.release.xcconfig */,
154 | 846DCFD110D2B4FF3CC857EE /* Pods-SwiftResolverTests.debug.xcconfig */,
155 | 0C68E75748576DF3EE8ABBD9 /* Pods-SwiftResolverTests.release.xcconfig */,
156 | );
157 | name = Pods;
158 | sourceTree = "";
159 | };
160 | A590733809B5EA4955B123DB /* Frameworks */ = {
161 | isa = PBXGroup;
162 | children = (
163 | 03345C50C145B8A58A0FFC51 /* Pods_Resolver.framework */,
164 | A13AA300353B8ED04CD3DB0A /* Pods_ResolverTests.framework */,
165 | 597E339A77FA2AE5407B7FBD /* Pods_SwiftResolver.framework */,
166 | BEB58DF8DAA83C3C88139B88 /* Pods_SwiftResolverTests.framework */,
167 | );
168 | name = Frameworks;
169 | sourceTree = "";
170 | };
171 | /* End PBXGroup section */
172 |
173 | /* Begin PBXHeadersBuildPhase section */
174 | 818B1EBF1EF2D4E8005F4434 /* Headers */ = {
175 | isa = PBXHeadersBuildPhase;
176 | buildActionMask = 2147483647;
177 | files = (
178 | 818B1EE01EF2D5B4005F4434 /* SwiftResolver.h in Headers */,
179 | );
180 | runOnlyForDeploymentPostprocessing = 0;
181 | };
182 | /* End PBXHeadersBuildPhase section */
183 |
184 | /* Begin PBXNativeTarget section */
185 | 818B1EC11EF2D4E8005F4434 /* SwiftResolver */ = {
186 | isa = PBXNativeTarget;
187 | buildConfigurationList = 818B1ED61EF2D4E8005F4434 /* Build configuration list for PBXNativeTarget "SwiftResolver" */;
188 | buildPhases = (
189 | 29E111A77A0822F49A91E801 /* [CP] Check Pods Manifest.lock */,
190 | 818B1EBD1EF2D4E8005F4434 /* Sources */,
191 | 818B1EBE1EF2D4E8005F4434 /* Frameworks */,
192 | 818B1EBF1EF2D4E8005F4434 /* Headers */,
193 | 818B1EC01EF2D4E8005F4434 /* Resources */,
194 | BB8EAFDE8F902540B0E2D77D /* [CP] Copy Pods Resources */,
195 | );
196 | buildRules = (
197 | );
198 | dependencies = (
199 | );
200 | name = SwiftResolver;
201 | productName = Resolver;
202 | productReference = 818B1EC21EF2D4E8005F4434 /* SwiftResolver.framework */;
203 | productType = "com.apple.product-type.framework";
204 | };
205 | 818B1ECA1EF2D4E8005F4434 /* SwiftResolverTests */ = {
206 | isa = PBXNativeTarget;
207 | buildConfigurationList = 818B1ED91EF2D4E8005F4434 /* Build configuration list for PBXNativeTarget "SwiftResolverTests" */;
208 | buildPhases = (
209 | 9D738A7D5CF86F6D43DA4D59 /* [CP] Check Pods Manifest.lock */,
210 | 818B1EC71EF2D4E8005F4434 /* Sources */,
211 | 818B1EC81EF2D4E8005F4434 /* Frameworks */,
212 | 818B1EC91EF2D4E8005F4434 /* Resources */,
213 | 8730A7B4988CB6F9BC8E365B /* [CP] Embed Pods Frameworks */,
214 | E6990911AA3057D12A24532B /* [CP] Copy Pods Resources */,
215 | );
216 | buildRules = (
217 | );
218 | dependencies = (
219 | 818B1ECE1EF2D4E8005F4434 /* PBXTargetDependency */,
220 | );
221 | name = SwiftResolverTests;
222 | productName = ResolverTests;
223 | productReference = 818B1ECB1EF2D4E8005F4434 /* SwiftResolverTests.xctest */;
224 | productType = "com.apple.product-type.bundle.unit-test";
225 | };
226 | /* End PBXNativeTarget section */
227 |
228 | /* Begin PBXProject section */
229 | 818B1EB91EF2D4E8005F4434 /* Project object */ = {
230 | isa = PBXProject;
231 | attributes = {
232 | LastSwiftUpdateCheck = 0900;
233 | LastUpgradeCheck = 1020;
234 | ORGANIZATIONNAME = 99;
235 | TargetAttributes = {
236 | 818B1EC11EF2D4E8005F4434 = {
237 | CreatedOnToolsVersion = 9.0;
238 | LastSwiftMigration = 0900;
239 | };
240 | 818B1ECA1EF2D4E8005F4434 = {
241 | CreatedOnToolsVersion = 9.0;
242 | LastSwiftMigration = 0900;
243 | };
244 | };
245 | };
246 | buildConfigurationList = 818B1EBC1EF2D4E8005F4434 /* Build configuration list for PBXProject "SwiftResolver" */;
247 | compatibilityVersion = "Xcode 8.0";
248 | developmentRegion = en;
249 | hasScannedForEncodings = 0;
250 | knownRegions = (
251 | en,
252 | Base,
253 | );
254 | mainGroup = 818B1EB81EF2D4E8005F4434;
255 | productRefGroup = 818B1EC31EF2D4E8005F4434 /* Products */;
256 | projectDirPath = "";
257 | projectRoot = "";
258 | targets = (
259 | 818B1EC11EF2D4E8005F4434 /* SwiftResolver */,
260 | 818B1ECA1EF2D4E8005F4434 /* SwiftResolverTests */,
261 | );
262 | };
263 | /* End PBXProject section */
264 |
265 | /* Begin PBXResourcesBuildPhase section */
266 | 818B1EC01EF2D4E8005F4434 /* Resources */ = {
267 | isa = PBXResourcesBuildPhase;
268 | buildActionMask = 2147483647;
269 | files = (
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | 818B1EC91EF2D4E8005F4434 /* Resources */ = {
274 | isa = PBXResourcesBuildPhase;
275 | buildActionMask = 2147483647;
276 | files = (
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | };
280 | /* End PBXResourcesBuildPhase section */
281 |
282 | /* Begin PBXShellScriptBuildPhase section */
283 | 29E111A77A0822F49A91E801 /* [CP] Check Pods Manifest.lock */ = {
284 | isa = PBXShellScriptBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | inputPaths = (
289 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
290 | "${PODS_ROOT}/Manifest.lock",
291 | );
292 | name = "[CP] Check Pods Manifest.lock";
293 | outputPaths = (
294 | "$(DERIVED_FILE_DIR)/Pods-SwiftResolver-checkManifestLockResult.txt",
295 | );
296 | runOnlyForDeploymentPostprocessing = 0;
297 | shellPath = /bin/sh;
298 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
299 | showEnvVarsInLog = 0;
300 | };
301 | 8730A7B4988CB6F9BC8E365B /* [CP] Embed Pods Frameworks */ = {
302 | isa = PBXShellScriptBuildPhase;
303 | buildActionMask = 2147483647;
304 | files = (
305 | );
306 | inputPaths = (
307 | "${SRCROOT}/Pods/Target Support Files/Pods-SwiftResolverTests/Pods-SwiftResolverTests-frameworks.sh",
308 | "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
309 | "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
310 | );
311 | name = "[CP] Embed Pods Frameworks";
312 | outputPaths = (
313 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework",
314 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework",
315 | );
316 | runOnlyForDeploymentPostprocessing = 0;
317 | shellPath = /bin/sh;
318 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftResolverTests/Pods-SwiftResolverTests-frameworks.sh\"\n";
319 | showEnvVarsInLog = 0;
320 | };
321 | 9D738A7D5CF86F6D43DA4D59 /* [CP] Check Pods Manifest.lock */ = {
322 | isa = PBXShellScriptBuildPhase;
323 | buildActionMask = 2147483647;
324 | files = (
325 | );
326 | inputPaths = (
327 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
328 | "${PODS_ROOT}/Manifest.lock",
329 | );
330 | name = "[CP] Check Pods Manifest.lock";
331 | outputPaths = (
332 | "$(DERIVED_FILE_DIR)/Pods-SwiftResolverTests-checkManifestLockResult.txt",
333 | );
334 | runOnlyForDeploymentPostprocessing = 0;
335 | shellPath = /bin/sh;
336 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
337 | showEnvVarsInLog = 0;
338 | };
339 | BB8EAFDE8F902540B0E2D77D /* [CP] Copy Pods Resources */ = {
340 | isa = PBXShellScriptBuildPhase;
341 | buildActionMask = 2147483647;
342 | files = (
343 | );
344 | inputPaths = (
345 | );
346 | name = "[CP] Copy Pods Resources";
347 | outputPaths = (
348 | );
349 | runOnlyForDeploymentPostprocessing = 0;
350 | shellPath = /bin/sh;
351 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftResolver/Pods-SwiftResolver-resources.sh\"\n";
352 | showEnvVarsInLog = 0;
353 | };
354 | E6990911AA3057D12A24532B /* [CP] Copy Pods Resources */ = {
355 | isa = PBXShellScriptBuildPhase;
356 | buildActionMask = 2147483647;
357 | files = (
358 | );
359 | inputPaths = (
360 | );
361 | name = "[CP] Copy Pods Resources";
362 | outputPaths = (
363 | );
364 | runOnlyForDeploymentPostprocessing = 0;
365 | shellPath = /bin/sh;
366 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftResolverTests/Pods-SwiftResolverTests-resources.sh\"\n";
367 | showEnvVarsInLog = 0;
368 | };
369 | /* End PBXShellScriptBuildPhase section */
370 |
371 | /* Begin PBXSourcesBuildPhase section */
372 | 818B1EBD1EF2D4E8005F4434 /* Sources */ = {
373 | isa = PBXSourcesBuildPhase;
374 | buildActionMask = 2147483647;
375 | files = (
376 | 818B1EF81EF2E2FA005F4434 /* Container.swift in Sources */,
377 | 636820292034BA6100532132 /* Atomic.swift in Sources */,
378 | 818B1EF91EF2E2FA005F4434 /* ContainerError.swift in Sources */,
379 | 63B2D783200D16FA001E5AB8 /* TypeSpecifier.swift in Sources */,
380 | 818B1EFA1EF2E2FA005F4434 /* DependencyPool.swift in Sources */,
381 | 818B1EFB1EF2E2FA005F4434 /* Factory.swift in Sources */,
382 | 818B1EFC1EF2E2FA005F4434 /* FactoryType.swift in Sources */,
383 | 818B1EFD1EF2E2FA005F4434 /* InstancePool.swift in Sources */,
384 | 63B2D781200D0C36001E5AB8 /* String+Helpers.swift in Sources */,
385 | );
386 | runOnlyForDeploymentPostprocessing = 0;
387 | };
388 | 818B1EC71EF2D4E8005F4434 /* Sources */ = {
389 | isa = PBXSourcesBuildPhase;
390 | buildActionMask = 2147483647;
391 | files = (
392 | 811CFA841F0352FC005521A7 /* ContainerFactory.swift in Sources */,
393 | 811CFA851F0352FC005521A7 /* ContainerTests.swift in Sources */,
394 | );
395 | runOnlyForDeploymentPostprocessing = 0;
396 | };
397 | /* End PBXSourcesBuildPhase section */
398 |
399 | /* Begin PBXTargetDependency section */
400 | 818B1ECE1EF2D4E8005F4434 /* PBXTargetDependency */ = {
401 | isa = PBXTargetDependency;
402 | target = 818B1EC11EF2D4E8005F4434 /* SwiftResolver */;
403 | targetProxy = 818B1ECD1EF2D4E8005F4434 /* PBXContainerItemProxy */;
404 | };
405 | /* End PBXTargetDependency section */
406 |
407 | /* Begin XCBuildConfiguration section */
408 | 818B1ED41EF2D4E8005F4434 /* Debug */ = {
409 | isa = XCBuildConfiguration;
410 | buildSettings = {
411 | ALWAYS_SEARCH_USER_PATHS = NO;
412 | CLANG_ANALYZER_NONNULL = YES;
413 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
414 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
415 | CLANG_CXX_LIBRARY = "libc++";
416 | CLANG_ENABLE_MODULES = YES;
417 | CLANG_ENABLE_OBJC_ARC = YES;
418 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
419 | CLANG_WARN_BOOL_CONVERSION = YES;
420 | CLANG_WARN_COMMA = YES;
421 | CLANG_WARN_CONSTANT_CONVERSION = YES;
422 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
423 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
424 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
425 | CLANG_WARN_EMPTY_BODY = YES;
426 | CLANG_WARN_ENUM_CONVERSION = YES;
427 | CLANG_WARN_INFINITE_RECURSION = YES;
428 | CLANG_WARN_INT_CONVERSION = YES;
429 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
430 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
431 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
432 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
433 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
434 | CLANG_WARN_STRICT_PROTOTYPES = YES;
435 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
436 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
437 | CLANG_WARN_UNREACHABLE_CODE = YES;
438 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
439 | CODE_SIGN_IDENTITY = "iPhone Developer";
440 | COPY_PHASE_STRIP = NO;
441 | CURRENT_PROJECT_VERSION = 1;
442 | DEBUG_INFORMATION_FORMAT = dwarf;
443 | ENABLE_STRICT_OBJC_MSGSEND = YES;
444 | ENABLE_TESTABILITY = YES;
445 | GCC_C_LANGUAGE_STANDARD = gnu11;
446 | GCC_DYNAMIC_NO_PIC = NO;
447 | GCC_NO_COMMON_BLOCKS = YES;
448 | GCC_OPTIMIZATION_LEVEL = 0;
449 | GCC_PREPROCESSOR_DEFINITIONS = (
450 | "DEBUG=1",
451 | "$(inherited)",
452 | );
453 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
454 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
455 | GCC_WARN_UNDECLARED_SELECTOR = YES;
456 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
457 | GCC_WARN_UNUSED_FUNCTION = YES;
458 | GCC_WARN_UNUSED_VARIABLE = YES;
459 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
460 | MTL_ENABLE_DEBUG_INFO = YES;
461 | ONLY_ACTIVE_ARCH = YES;
462 | SDKROOT = iphoneos;
463 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
464 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
465 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
466 | SWIFT_VERSION = 5.0;
467 | VERSIONING_SYSTEM = "apple-generic";
468 | VERSION_INFO_PREFIX = "";
469 | };
470 | name = Debug;
471 | };
472 | 818B1ED51EF2D4E8005F4434 /* Release */ = {
473 | isa = XCBuildConfiguration;
474 | buildSettings = {
475 | ALWAYS_SEARCH_USER_PATHS = NO;
476 | CLANG_ANALYZER_NONNULL = YES;
477 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
478 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
479 | CLANG_CXX_LIBRARY = "libc++";
480 | CLANG_ENABLE_MODULES = YES;
481 | CLANG_ENABLE_OBJC_ARC = YES;
482 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
483 | CLANG_WARN_BOOL_CONVERSION = YES;
484 | CLANG_WARN_COMMA = YES;
485 | CLANG_WARN_CONSTANT_CONVERSION = YES;
486 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
487 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
488 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
489 | CLANG_WARN_EMPTY_BODY = YES;
490 | CLANG_WARN_ENUM_CONVERSION = YES;
491 | CLANG_WARN_INFINITE_RECURSION = YES;
492 | CLANG_WARN_INT_CONVERSION = YES;
493 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
494 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
495 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
496 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
497 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
498 | CLANG_WARN_STRICT_PROTOTYPES = YES;
499 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
500 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
501 | CLANG_WARN_UNREACHABLE_CODE = YES;
502 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
503 | CODE_SIGN_IDENTITY = "iPhone Developer";
504 | COPY_PHASE_STRIP = NO;
505 | CURRENT_PROJECT_VERSION = 1;
506 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
507 | ENABLE_NS_ASSERTIONS = NO;
508 | ENABLE_STRICT_OBJC_MSGSEND = YES;
509 | GCC_C_LANGUAGE_STANDARD = gnu11;
510 | GCC_NO_COMMON_BLOCKS = YES;
511 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
512 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
513 | GCC_WARN_UNDECLARED_SELECTOR = YES;
514 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
515 | GCC_WARN_UNUSED_FUNCTION = YES;
516 | GCC_WARN_UNUSED_VARIABLE = YES;
517 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
518 | MTL_ENABLE_DEBUG_INFO = NO;
519 | SDKROOT = iphoneos;
520 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
521 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
522 | SWIFT_VERSION = 5.0;
523 | VALIDATE_PRODUCT = YES;
524 | VERSIONING_SYSTEM = "apple-generic";
525 | VERSION_INFO_PREFIX = "";
526 | };
527 | name = Release;
528 | };
529 | 818B1ED71EF2D4E8005F4434 /* Debug */ = {
530 | isa = XCBuildConfiguration;
531 | baseConfigurationReference = 7CC65F404B89B5AD2378C71F /* Pods-SwiftResolver.debug.xcconfig */;
532 | buildSettings = {
533 | CLANG_ENABLE_MODULES = YES;
534 | CODE_SIGN_IDENTITY = "";
535 | DEFINES_MODULE = YES;
536 | DEVELOPMENT_TEAM = X36AT7C9SA;
537 | DYLIB_COMPATIBILITY_VERSION = 1;
538 | DYLIB_CURRENT_VERSION = 1;
539 | DYLIB_INSTALL_NAME_BASE = "@rpath";
540 | INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
541 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
542 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
543 | PRODUCT_BUNDLE_IDENTIFIER = br.com.99taxis.Resolver;
544 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
545 | SKIP_INSTALL = YES;
546 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
547 | TARGETED_DEVICE_FAMILY = "1,2";
548 | };
549 | name = Debug;
550 | };
551 | 818B1ED81EF2D4E8005F4434 /* Release */ = {
552 | isa = XCBuildConfiguration;
553 | baseConfigurationReference = AE1EC9E52477912A25EBAA5C /* Pods-SwiftResolver.release.xcconfig */;
554 | buildSettings = {
555 | CLANG_ENABLE_MODULES = YES;
556 | CODE_SIGN_IDENTITY = "";
557 | DEFINES_MODULE = YES;
558 | DEVELOPMENT_TEAM = X36AT7C9SA;
559 | DYLIB_COMPATIBILITY_VERSION = 1;
560 | DYLIB_CURRENT_VERSION = 1;
561 | DYLIB_INSTALL_NAME_BASE = "@rpath";
562 | INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
563 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
565 | PRODUCT_BUNDLE_IDENTIFIER = br.com.99taxis.Resolver;
566 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
567 | SKIP_INSTALL = YES;
568 | TARGETED_DEVICE_FAMILY = "1,2";
569 | };
570 | name = Release;
571 | };
572 | 818B1EDA1EF2D4E8005F4434 /* Debug */ = {
573 | isa = XCBuildConfiguration;
574 | baseConfigurationReference = 846DCFD110D2B4FF3CC857EE /* Pods-SwiftResolverTests.debug.xcconfig */;
575 | buildSettings = {
576 | DEVELOPMENT_TEAM = LB67YZTW2P;
577 | INFOPLIST_FILE = SwiftResolverTests/Info.plist;
578 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
579 | PRODUCT_BUNDLE_IDENTIFIER = br.com.99taxis.ResolverTests;
580 | PRODUCT_NAME = "$(TARGET_NAME)";
581 | TARGETED_DEVICE_FAMILY = "1,2";
582 | };
583 | name = Debug;
584 | };
585 | 818B1EDB1EF2D4E8005F4434 /* Release */ = {
586 | isa = XCBuildConfiguration;
587 | baseConfigurationReference = 0C68E75748576DF3EE8ABBD9 /* Pods-SwiftResolverTests.release.xcconfig */;
588 | buildSettings = {
589 | DEVELOPMENT_TEAM = LB67YZTW2P;
590 | INFOPLIST_FILE = SwiftResolverTests/Info.plist;
591 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
592 | PRODUCT_BUNDLE_IDENTIFIER = br.com.99taxis.ResolverTests;
593 | PRODUCT_NAME = "$(TARGET_NAME)";
594 | TARGETED_DEVICE_FAMILY = "1,2";
595 | };
596 | name = Release;
597 | };
598 | /* End XCBuildConfiguration section */
599 |
600 | /* Begin XCConfigurationList section */
601 | 818B1EBC1EF2D4E8005F4434 /* Build configuration list for PBXProject "SwiftResolver" */ = {
602 | isa = XCConfigurationList;
603 | buildConfigurations = (
604 | 818B1ED41EF2D4E8005F4434 /* Debug */,
605 | 818B1ED51EF2D4E8005F4434 /* Release */,
606 | );
607 | defaultConfigurationIsVisible = 0;
608 | defaultConfigurationName = Release;
609 | };
610 | 818B1ED61EF2D4E8005F4434 /* Build configuration list for PBXNativeTarget "SwiftResolver" */ = {
611 | isa = XCConfigurationList;
612 | buildConfigurations = (
613 | 818B1ED71EF2D4E8005F4434 /* Debug */,
614 | 818B1ED81EF2D4E8005F4434 /* Release */,
615 | );
616 | defaultConfigurationIsVisible = 0;
617 | defaultConfigurationName = Release;
618 | };
619 | 818B1ED91EF2D4E8005F4434 /* Build configuration list for PBXNativeTarget "SwiftResolverTests" */ = {
620 | isa = XCConfigurationList;
621 | buildConfigurations = (
622 | 818B1EDA1EF2D4E8005F4434 /* Debug */,
623 | 818B1EDB1EF2D4E8005F4434 /* Release */,
624 | );
625 | defaultConfigurationIsVisible = 0;
626 | defaultConfigurationName = Release;
627 | };
628 | /* End XCConfigurationList section */
629 | };
630 | rootObject = 818B1EB91EF2D4E8005F4434 /* Project object */;
631 | }
632 |
--------------------------------------------------------------------------------
/SwiftResolver.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftResolver.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SwiftResolver.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SwiftResolverTests/ContainerFactory.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | final class SomeDependency {}
4 | final class SomeType {
5 | let dependency: SomeDependency
6 | init(dependency: SomeDependency) {
7 | self.dependency = dependency
8 | }
9 | }
10 |
11 | final class Child {}
12 |
13 | final class Father {
14 | let child: Child
15 | init(child: Child) {
16 | self.child = child
17 | }
18 | }
19 |
20 | final class Mother {
21 | let child: Child
22 | init(child: Child) {
23 | self.child = child
24 | }
25 | }
26 |
27 | final class Family {
28 | let father: Father
29 | let mother: Mother
30 | let child: Child
31 | init(father: Father, mother: Mother, child: Child) {
32 | self.father = father
33 | self.mother = mother
34 | self.child = child
35 | }
36 | }
37 |
38 | final class House {
39 | let family: Family
40 | let owner: Father
41 |
42 | init(owner: Father, family: Family) {
43 | self.family = family
44 | self.owner = owner
45 | }
46 | }
47 |
48 | final class Street {
49 | let house1: House
50 | let house2: House
51 | let house3: House
52 | let house4: House
53 | let house5: House
54 |
55 | init(house1: House,
56 | house2: House,
57 | house3: House,
58 | house4: House,
59 | house5: House) {
60 | self.house1 = house1
61 | self.house2 = house2
62 | self.house3 = house3
63 | self.house4 = house4
64 | self.house5 = house5
65 | }
66 | }
67 |
68 | protocol Animal {
69 | func makeSound()
70 | }
71 |
72 | final class Cat: Animal {
73 | func makeSound() {
74 | print("Gato")
75 | }
76 | }
77 |
78 | final class Dog: Animal {
79 | var name: String = ""
80 | func makeSound() {
81 | print("Cachoro")
82 | }
83 |
84 | static func with(name: String) -> Dog {
85 | let dog = Dog()
86 | dog.name = name
87 | return dog
88 | }
89 | }
90 |
91 | enum Dogs: String {
92 | case teo
93 | case bob
94 | }
95 |
--------------------------------------------------------------------------------
/SwiftResolverTests/ContainerTests.swift:
--------------------------------------------------------------------------------
1 | import Quick
2 | import Nimble
3 | @testable import SwiftResolver
4 |
5 | class ContainerTests: QuickSpec {
6 | override func spec() {
7 | describe("when deallocating") {
8 | it("should not create reference cycles") {
9 | var container: Container! = Container()
10 | weak var weakContainer: Container? = container
11 | container.register(scope: .instance, Child.init)
12 | container.register(scope: .shared, Father.init)
13 | container.register(scope: .singleton, Mother.init)
14 | container.register(Family.init)
15 | container.register(House.init)
16 | container.register(Street.init)
17 | _ = container.resolve() as Child
18 | _ = container.resolve() as Father
19 | _ = container.resolve() as Mother
20 | _ = container.resolve() as Family
21 | _ = container.resolve() as House
22 | _ = container.resolve() as Street
23 | container = nil
24 | expect(weakContainer).to(beNil())
25 | }
26 | }
27 | describe("when registering with tags") {
28 | var container: Container!
29 | beforeEach {
30 | container = Container()
31 | }
32 | it("should resolve same type with different tags") {
33 | container.register { Dog.with(name: "Téo") }.tag(Dogs.teo)
34 | container.register { Dog.with(name: "Bob") }.tag(Dogs.bob)
35 | let teo = container.resolve(Dogs.teo) as Dog
36 | let bob = container.resolve(Dogs.bob) as Dog
37 | expect(teo.name).to(equal("Téo"))
38 | expect(bob.name).to(equal("Bob"))
39 | }
40 | }
41 | describe("when registering multiple instances of the same type") {
42 | var container: Container!
43 | beforeEach {
44 | container = Container()
45 | }
46 | it("should resolve generic type") {
47 | container.register(Dog.init).as(Animal.self)
48 | let animal: Animal = container.resolve()
49 | expect(animal).to(beAKindOf(Dog.self))
50 | }
51 | it("should resolve specific type") {
52 | container.register(Dog.init).as(Animal.self)
53 | let animal: Dog = container.resolve()
54 | expect(animal).to(beAKindOf(Dog.self))
55 | }
56 | it("should resolve with specific type as parameter") {
57 | container.register(Cat.init).as(Animal.self)
58 | container.register(Dog.init).as(Animal.self)
59 | let animal: Animal = container.resolve(Dog.self)
60 | expect(animal).to(beAKindOf(Dog.self))
61 | }
62 | }
63 | describe("when registering types") {
64 | var container: Container!
65 | beforeEach {
66 | container = Container()
67 | }
68 | it("with 0...5 dependencies") {
69 | container.register(Child.init)
70 | container.register(Mother.init)
71 | container.register { Family(father: $0, mother: $1, child: $2) }
72 | container.register(Father.init)
73 | container.register(House.init)
74 | container.register(Street.init)
75 | }
76 | }
77 | describe("when resolving types") {
78 | var container: Container!
79 | beforeEach {
80 | container = Container()
81 | container.register(Child.init)
82 | container.register(Father.init)
83 | container.register(Mother.init)
84 | container.register(Family.init)
85 | container.register(House.init)
86 | container.register(Street.init)
87 | }
88 | it("with 0...5 dependencies") {
89 | let child: Child = container.resolve()
90 | let father: Father = container.resolve()
91 | let mother: Mother = container.resolve()
92 | let family: Family = container.resolve()
93 | let house: House = container.resolve()
94 | let street: Street = container.resolve()
95 |
96 | expect(child).to(beAKindOf(Child.self))
97 | expect(father).to(beAKindOf(Father.self))
98 | expect(mother).to(beAKindOf(Mother.self))
99 | expect(family).to(beAKindOf(Family.self))
100 | expect(house).to(beAKindOf(House.self))
101 | expect(street).to(beAKindOf(Street.self))
102 | }
103 | it("should fail for unregistered type") {
104 | expect { _ = container.resolve() as SomeType }.to(throwAssertion())
105 | }
106 | it("should fail for unregistered dependency") {
107 | container.register(SomeType.init)
108 | expect { _ = container.resolve() as SomeType }.to(throwAssertion())
109 | }
110 | }
111 | describe("when resolving types for") {
112 | var container: Container!
113 | describe("instance scope") {
114 | beforeEach {
115 | container = Container()
116 | }
117 | it("should create new instance whenever needed specified type") {
118 | container.register(Child.init)
119 | container.register(Father.init)
120 | container.register(Mother.init)
121 |
122 | let child = container.resolve() as Child
123 | let father = container.resolve() as Father
124 | let mother = container.resolve() as Mother
125 |
126 | expect(container.instanceCountFor(Child.self)).to(equal(3))
127 | expect(expression: { child !== mother.child }).to(beTrue())
128 | expect(expression: { child !== father.child }).to(beTrue())
129 | expect(expression: { father.child !== mother.child }).to(beTrue())
130 | }
131 | }
132 | describe("shared scope") {
133 | beforeEach {
134 | container = Container()
135 | }
136 | it("should use same instance when building tree") {
137 | container.register(scope: .shared, Child.init)
138 | container.register(Father.init)
139 | container.register(Mother.init)
140 | container.register(Family.init)
141 |
142 | let family = container.resolve() as Family
143 |
144 | expect(container.instanceCountFor(Child.self)).to(equal(1))
145 | expect(expression: { family.child === family.father.child }).to(beTrue())
146 | expect(expression: { family.child === family.mother.child }).to(beTrue())
147 | }
148 | it("should use create new instances for different trees") {
149 | container.register(scope: .shared, Child.init)
150 | container.register(Father.init)
151 | container.register(Mother.init)
152 |
153 | let father = container.resolve() as Father
154 | let mother = container.resolve() as Mother
155 |
156 | expect(container.instanceCountFor(Child.self)).to(equal(2))
157 | expect(expression: { father.child !== mother.child }).to(beTrue())
158 | }
159 | it("should use new dependency graph if resolver is called") {
160 | container.register(scope: .shared, Child.init)
161 | container.register(scope: .shared, Father.init)
162 | container.register(Mother.init)
163 |
164 | container.register { Family(father: container.resolve(),
165 | mother: container.resolve(),
166 | child: container.resolve()) }
167 |
168 | container.register(House.init)
169 |
170 | let family = container.resolve() as Family
171 | let house = container.resolve() as House
172 |
173 | expect(expression: { family.father.child !== family.mother.child }).to(beTrue())
174 | expect(expression: { family.child !== family.mother.child }).to(beTrue())
175 | expect(expression: { family.child !== family.father.child }).to(beTrue())
176 | expect(expression: { house.family.father !== house.owner }).to(beTrue())
177 | expect(expression: { house.family.father.child !== house.owner.child }).to(beTrue())
178 | }
179 | }
180 | describe("singleton scope") {
181 | beforeEach {
182 | container = Container()
183 | }
184 | it("should use same instance on whenever needed") {
185 | container.register(scope: .singleton, Child.init)
186 | container.register(Father.init)
187 | container.register(Mother.init)
188 |
189 | let mother = container.resolve() as Mother
190 | let father = container.resolve() as Father
191 |
192 | expect(container.instanceCountFor(Child.self)).to(equal(1))
193 | expect(expression: { mother.child === father.child }).to(beTrue())
194 | }
195 | }
196 | }
197 | }
198 | }
199 |
200 |
--------------------------------------------------------------------------------
/SwiftResolverTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorial/Example1/.gitignore:
--------------------------------------------------------------------------------
1 | Pods
--------------------------------------------------------------------------------
/tutorial/Example1/Example1.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6364028B203464130075F3E7 /* WhyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6364028A203464130075F3E7 /* WhyTests.swift */; };
11 | 636402A4203464910075F3E7 /* GithubViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63640299203464910075F3E7 /* GithubViewController.swift */; };
12 | 636402A5203464910075F3E7 /* RequestProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6364029B203464910075F3E7 /* RequestProvider.swift */; };
13 | 636402A6203464910075F3E7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6364029C203464910075F3E7 /* AppDelegate.swift */; };
14 | 636402A7203464910075F3E7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6364029E203464910075F3E7 /* Assets.xcassets */; };
15 | 636402A8203464910075F3E7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6364029F203464910075F3E7 /* LaunchScreen.storyboard */; };
16 | 636402AC203479660075F3E7 /* Future.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402AB203479660075F3E7 /* Future.swift */; };
17 | 636402AE203479800075F3E7 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402AD203479800075F3E7 /* Result.swift */; };
18 | 636402B020347C650075F3E7 /* GithubTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402AF20347C650075F3E7 /* GithubTarget.swift */; };
19 | 636402B220347CCA0075F3E7 /* DataError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402B120347CCA0075F3E7 /* DataError.swift */; };
20 | 636402B520347E070075F3E7 /* GithubRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402B420347E070075F3E7 /* GithubRepository.swift */; };
21 | 636402B820347E290075F3E7 /* GithubRepositoryInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402B720347E290075F3E7 /* GithubRepositoryInformation.swift */; };
22 | 636402BA2034863B0075F3E7 /* Scheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402B92034863B0075F3E7 /* Scheduler.swift */; };
23 | 636402BC20349DF10075F3E7 /* AppContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402BB20349DF10075F3E7 /* AppContainer.swift */; };
24 | 636402BE2034ADC00075F3E7 /* AuthenticationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636402BD2034ADC00075F3E7 /* AuthenticationRepository.swift */; };
25 | 69688C91E4338223DDF9BA9B /* Pods_WhyTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A499C9571538DBD6EF18B557 /* Pods_WhyTests.framework */; };
26 | A0E82103952106911C82CFDD /* Pods_Example1Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4034A2FD960A6B39A72469A4 /* Pods_Example1Tests.framework */; };
27 | D82EA580559131DB54E7BFB7 /* Pods_Example1.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63BDC33D958F7BC03E8015C6 /* Pods_Example1.framework */; };
28 | /* End PBXBuildFile section */
29 |
30 | /* Begin PBXContainerItemProxy section */
31 | 63640287203464130075F3E7 /* PBXContainerItemProxy */ = {
32 | isa = PBXContainerItemProxy;
33 | containerPortal = 6364026A203464130075F3E7 /* Project object */;
34 | proxyType = 1;
35 | remoteGlobalIDString = 63640271203464130075F3E7;
36 | remoteInfo = Why;
37 | };
38 | /* End PBXContainerItemProxy section */
39 |
40 | /* Begin PBXFileReference section */
41 | 0C46D1F634FE1F416403BA90 /* Pods-Example1Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example1Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example1Tests/Pods-Example1Tests.release.xcconfig"; sourceTree = ""; };
42 | 10E92568B1603261C6625490 /* Pods_Why.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Why.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 20C94F250E48B7BA5BDB5DBE /* Pods-Example1.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example1.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example1/Pods-Example1.release.xcconfig"; sourceTree = ""; };
44 | 4034A2FD960A6B39A72469A4 /* Pods_Example1Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example1Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45 | 63640272203464130075F3E7 /* Example1.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example1.app; sourceTree = BUILT_PRODUCTS_DIR; };
46 | 63640286203464130075F3E7 /* Example1Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Example1Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 6364028A203464130075F3E7 /* WhyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhyTests.swift; sourceTree = ""; };
48 | 6364028C203464130075F3E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 63640299203464910075F3E7 /* GithubViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GithubViewController.swift; sourceTree = ""; };
50 | 6364029B203464910075F3E7 /* RequestProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestProvider.swift; sourceTree = ""; };
51 | 6364029C203464910075F3E7 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
52 | 6364029E203464910075F3E7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
53 | 636402A0203464910075F3E7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
54 | 636402A3203464910075F3E7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
55 | 636402AB203479660075F3E7 /* Future.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Future.swift; sourceTree = ""; };
56 | 636402AD203479800075F3E7 /* Result.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; };
57 | 636402AF20347C650075F3E7 /* GithubTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubTarget.swift; sourceTree = ""; };
58 | 636402B120347CCA0075F3E7 /* DataError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataError.swift; sourceTree = ""; };
59 | 636402B420347E070075F3E7 /* GithubRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubRepository.swift; sourceTree = ""; };
60 | 636402B720347E290075F3E7 /* GithubRepositoryInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubRepositoryInformation.swift; sourceTree = ""; };
61 | 636402B92034863B0075F3E7 /* Scheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scheduler.swift; sourceTree = ""; };
62 | 636402BB20349DF10075F3E7 /* AppContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppContainer.swift; sourceTree = ""; };
63 | 636402BD2034ADC00075F3E7 /* AuthenticationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationRepository.swift; sourceTree = ""; };
64 | 63BDC33D958F7BC03E8015C6 /* Pods_Example1.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example1.framework; sourceTree = BUILT_PRODUCTS_DIR; };
65 | 78ADD8256CCE1393E034913E /* Pods-Example1Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example1Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example1Tests/Pods-Example1Tests.debug.xcconfig"; sourceTree = ""; };
66 | A499C9571538DBD6EF18B557 /* Pods_WhyTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WhyTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
67 | C5B56A3EC3DE7AEE8AEC52E0 /* Pods-Example1.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example1.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example1/Pods-Example1.debug.xcconfig"; sourceTree = ""; };
68 | /* End PBXFileReference section */
69 |
70 | /* Begin PBXFrameworksBuildPhase section */
71 | 6364026F203464130075F3E7 /* Frameworks */ = {
72 | isa = PBXFrameworksBuildPhase;
73 | buildActionMask = 2147483647;
74 | files = (
75 | D82EA580559131DB54E7BFB7 /* Pods_Example1.framework in Frameworks */,
76 | );
77 | runOnlyForDeploymentPostprocessing = 0;
78 | };
79 | 63640283203464130075F3E7 /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | 69688C91E4338223DDF9BA9B /* Pods_WhyTests.framework in Frameworks */,
84 | A0E82103952106911C82CFDD /* Pods_Example1Tests.framework in Frameworks */,
85 | );
86 | runOnlyForDeploymentPostprocessing = 0;
87 | };
88 | /* End PBXFrameworksBuildPhase section */
89 |
90 | /* Begin PBXGroup section */
91 | 5D081C60C00C8817D8CCE76D /* Pods */ = {
92 | isa = PBXGroup;
93 | children = (
94 | C5B56A3EC3DE7AEE8AEC52E0 /* Pods-Example1.debug.xcconfig */,
95 | 20C94F250E48B7BA5BDB5DBE /* Pods-Example1.release.xcconfig */,
96 | 78ADD8256CCE1393E034913E /* Pods-Example1Tests.debug.xcconfig */,
97 | 0C46D1F634FE1F416403BA90 /* Pods-Example1Tests.release.xcconfig */,
98 | );
99 | name = Pods;
100 | sourceTree = "";
101 | };
102 | 63640269203464130075F3E7 = {
103 | isa = PBXGroup;
104 | children = (
105 | 63640274203464130075F3E7 /* Example1 */,
106 | 63640289203464130075F3E7 /* Example1Tests */,
107 | 63640273203464130075F3E7 /* Products */,
108 | 5D081C60C00C8817D8CCE76D /* Pods */,
109 | A288D6F6ABA12E272F4C5908 /* Frameworks */,
110 | );
111 | sourceTree = "";
112 | };
113 | 63640273203464130075F3E7 /* Products */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 63640272203464130075F3E7 /* Example1.app */,
117 | 63640286203464130075F3E7 /* Example1Tests.xctest */,
118 | );
119 | name = Products;
120 | sourceTree = "";
121 | };
122 | 63640274203464130075F3E7 /* Example1 */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 6364029D203464910075F3E7 /* Assets */,
126 | 63640298203464910075F3E7 /* Classes */,
127 | );
128 | path = Example1;
129 | sourceTree = "";
130 | };
131 | 63640289203464130075F3E7 /* Example1Tests */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 6364028A203464130075F3E7 /* WhyTests.swift */,
135 | 6364028C203464130075F3E7 /* Info.plist */,
136 | );
137 | path = Example1Tests;
138 | sourceTree = "";
139 | };
140 | 63640298203464910075F3E7 /* Classes */ = {
141 | isa = PBXGroup;
142 | children = (
143 | 636402BB20349DF10075F3E7 /* AppContainer.swift */,
144 | 6364029C203464910075F3E7 /* AppDelegate.swift */,
145 | 636402BF2034B1B40075F3E7 /* Home */,
146 | 636402B620347E220075F3E7 /* Model */,
147 | 636402B320347DFA0075F3E7 /* Repository */,
148 | 6364029A203464910075F3E7 /* RequestProvider */,
149 | );
150 | path = Classes;
151 | sourceTree = "";
152 | };
153 | 6364029A203464910075F3E7 /* RequestProvider */ = {
154 | isa = PBXGroup;
155 | children = (
156 | 636402B120347CCA0075F3E7 /* DataError.swift */,
157 | 636402AB203479660075F3E7 /* Future.swift */,
158 | 636402AF20347C650075F3E7 /* GithubTarget.swift */,
159 | 6364029B203464910075F3E7 /* RequestProvider.swift */,
160 | 636402AD203479800075F3E7 /* Result.swift */,
161 | 636402B92034863B0075F3E7 /* Scheduler.swift */,
162 | );
163 | path = RequestProvider;
164 | sourceTree = "";
165 | };
166 | 6364029D203464910075F3E7 /* Assets */ = {
167 | isa = PBXGroup;
168 | children = (
169 | 6364029E203464910075F3E7 /* Assets.xcassets */,
170 | 6364029F203464910075F3E7 /* LaunchScreen.storyboard */,
171 | 636402A3203464910075F3E7 /* Info.plist */,
172 | );
173 | path = Assets;
174 | sourceTree = "";
175 | };
176 | 636402B320347DFA0075F3E7 /* Repository */ = {
177 | isa = PBXGroup;
178 | children = (
179 | 636402B420347E070075F3E7 /* GithubRepository.swift */,
180 | 636402BD2034ADC00075F3E7 /* AuthenticationRepository.swift */,
181 | );
182 | path = Repository;
183 | sourceTree = "";
184 | };
185 | 636402B620347E220075F3E7 /* Model */ = {
186 | isa = PBXGroup;
187 | children = (
188 | 636402B720347E290075F3E7 /* GithubRepositoryInformation.swift */,
189 | );
190 | path = Model;
191 | sourceTree = "";
192 | };
193 | 636402BF2034B1B40075F3E7 /* Home */ = {
194 | isa = PBXGroup;
195 | children = (
196 | 63640299203464910075F3E7 /* GithubViewController.swift */,
197 | );
198 | path = Home;
199 | sourceTree = "";
200 | };
201 | A288D6F6ABA12E272F4C5908 /* Frameworks */ = {
202 | isa = PBXGroup;
203 | children = (
204 | 10E92568B1603261C6625490 /* Pods_Why.framework */,
205 | A499C9571538DBD6EF18B557 /* Pods_WhyTests.framework */,
206 | 63BDC33D958F7BC03E8015C6 /* Pods_Example1.framework */,
207 | 4034A2FD960A6B39A72469A4 /* Pods_Example1Tests.framework */,
208 | );
209 | name = Frameworks;
210 | sourceTree = "";
211 | };
212 | /* End PBXGroup section */
213 |
214 | /* Begin PBXNativeTarget section */
215 | 63640271203464130075F3E7 /* Example1 */ = {
216 | isa = PBXNativeTarget;
217 | buildConfigurationList = 6364028F203464130075F3E7 /* Build configuration list for PBXNativeTarget "Example1" */;
218 | buildPhases = (
219 | 1CCB8A910B94494509EA7870 /* [CP] Check Pods Manifest.lock */,
220 | 6364026E203464130075F3E7 /* Sources */,
221 | 6364026F203464130075F3E7 /* Frameworks */,
222 | 63640270203464130075F3E7 /* Resources */,
223 | D91C50F52D83BDBF79F4A6F8 /* [CP] Embed Pods Frameworks */,
224 | FF3FBA1C4373788C805DBC35 /* [CP] Copy Pods Resources */,
225 | );
226 | buildRules = (
227 | );
228 | dependencies = (
229 | );
230 | name = Example1;
231 | productName = Why;
232 | productReference = 63640272203464130075F3E7 /* Example1.app */;
233 | productType = "com.apple.product-type.application";
234 | };
235 | 63640285203464130075F3E7 /* Example1Tests */ = {
236 | isa = PBXNativeTarget;
237 | buildConfigurationList = 63640292203464130075F3E7 /* Build configuration list for PBXNativeTarget "Example1Tests" */;
238 | buildPhases = (
239 | 0BBD1109D94B489C847A7F54 /* [CP] Check Pods Manifest.lock */,
240 | 63640282203464130075F3E7 /* Sources */,
241 | 63640283203464130075F3E7 /* Frameworks */,
242 | 63640284203464130075F3E7 /* Resources */,
243 | 5807DE64F20592842B7E987F /* [CP] Embed Pods Frameworks */,
244 | 32DF6B2787566EACEA51EC79 /* [CP] Copy Pods Resources */,
245 | );
246 | buildRules = (
247 | );
248 | dependencies = (
249 | 63640288203464130075F3E7 /* PBXTargetDependency */,
250 | );
251 | name = Example1Tests;
252 | productName = WhyTests;
253 | productReference = 63640286203464130075F3E7 /* Example1Tests.xctest */;
254 | productType = "com.apple.product-type.bundle.unit-test";
255 | };
256 | /* End PBXNativeTarget section */
257 |
258 | /* Begin PBXProject section */
259 | 6364026A203464130075F3E7 /* Project object */ = {
260 | isa = PBXProject;
261 | attributes = {
262 | LastSwiftUpdateCheck = 0920;
263 | LastUpgradeCheck = 0920;
264 | ORGANIZATIONNAME = SwiftResolver;
265 | TargetAttributes = {
266 | 63640271203464130075F3E7 = {
267 | CreatedOnToolsVersion = 9.2;
268 | ProvisioningStyle = Automatic;
269 | };
270 | 63640285203464130075F3E7 = {
271 | CreatedOnToolsVersion = 9.2;
272 | ProvisioningStyle = Automatic;
273 | TestTargetID = 63640271203464130075F3E7;
274 | };
275 | };
276 | };
277 | buildConfigurationList = 6364026D203464130075F3E7 /* Build configuration list for PBXProject "Example1" */;
278 | compatibilityVersion = "Xcode 8.0";
279 | developmentRegion = en;
280 | hasScannedForEncodings = 0;
281 | knownRegions = (
282 | en,
283 | Base,
284 | );
285 | mainGroup = 63640269203464130075F3E7;
286 | productRefGroup = 63640273203464130075F3E7 /* Products */;
287 | projectDirPath = "";
288 | projectRoot = "";
289 | targets = (
290 | 63640271203464130075F3E7 /* Example1 */,
291 | 63640285203464130075F3E7 /* Example1Tests */,
292 | );
293 | };
294 | /* End PBXProject section */
295 |
296 | /* Begin PBXResourcesBuildPhase section */
297 | 63640270203464130075F3E7 /* Resources */ = {
298 | isa = PBXResourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | 636402A7203464910075F3E7 /* Assets.xcassets in Resources */,
302 | 636402A8203464910075F3E7 /* LaunchScreen.storyboard in Resources */,
303 | );
304 | runOnlyForDeploymentPostprocessing = 0;
305 | };
306 | 63640284203464130075F3E7 /* Resources */ = {
307 | isa = PBXResourcesBuildPhase;
308 | buildActionMask = 2147483647;
309 | files = (
310 | );
311 | runOnlyForDeploymentPostprocessing = 0;
312 | };
313 | /* End PBXResourcesBuildPhase section */
314 |
315 | /* Begin PBXShellScriptBuildPhase section */
316 | 0BBD1109D94B489C847A7F54 /* [CP] Check Pods Manifest.lock */ = {
317 | isa = PBXShellScriptBuildPhase;
318 | buildActionMask = 2147483647;
319 | files = (
320 | );
321 | inputPaths = (
322 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
323 | "${PODS_ROOT}/Manifest.lock",
324 | );
325 | name = "[CP] Check Pods Manifest.lock";
326 | outputPaths = (
327 | "$(DERIVED_FILE_DIR)/Pods-Example1Tests-checkManifestLockResult.txt",
328 | );
329 | runOnlyForDeploymentPostprocessing = 0;
330 | shellPath = /bin/sh;
331 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
332 | showEnvVarsInLog = 0;
333 | };
334 | 1CCB8A910B94494509EA7870 /* [CP] Check Pods Manifest.lock */ = {
335 | isa = PBXShellScriptBuildPhase;
336 | buildActionMask = 2147483647;
337 | files = (
338 | );
339 | inputPaths = (
340 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
341 | "${PODS_ROOT}/Manifest.lock",
342 | );
343 | name = "[CP] Check Pods Manifest.lock";
344 | outputPaths = (
345 | "$(DERIVED_FILE_DIR)/Pods-Example1-checkManifestLockResult.txt",
346 | );
347 | runOnlyForDeploymentPostprocessing = 0;
348 | shellPath = /bin/sh;
349 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
350 | showEnvVarsInLog = 0;
351 | };
352 | 32DF6B2787566EACEA51EC79 /* [CP] Copy Pods Resources */ = {
353 | isa = PBXShellScriptBuildPhase;
354 | buildActionMask = 2147483647;
355 | files = (
356 | );
357 | inputPaths = (
358 | );
359 | name = "[CP] Copy Pods Resources";
360 | outputPaths = (
361 | );
362 | runOnlyForDeploymentPostprocessing = 0;
363 | shellPath = /bin/sh;
364 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example1Tests/Pods-Example1Tests-resources.sh\"\n";
365 | showEnvVarsInLog = 0;
366 | };
367 | 5807DE64F20592842B7E987F /* [CP] Embed Pods Frameworks */ = {
368 | isa = PBXShellScriptBuildPhase;
369 | buildActionMask = 2147483647;
370 | files = (
371 | );
372 | inputPaths = (
373 | );
374 | name = "[CP] Embed Pods Frameworks";
375 | outputPaths = (
376 | );
377 | runOnlyForDeploymentPostprocessing = 0;
378 | shellPath = /bin/sh;
379 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example1Tests/Pods-Example1Tests-frameworks.sh\"\n";
380 | showEnvVarsInLog = 0;
381 | };
382 | D91C50F52D83BDBF79F4A6F8 /* [CP] Embed Pods Frameworks */ = {
383 | isa = PBXShellScriptBuildPhase;
384 | buildActionMask = 2147483647;
385 | files = (
386 | );
387 | inputPaths = (
388 | "${SRCROOT}/Pods/Target Support Files/Pods-Example1/Pods-Example1-frameworks.sh",
389 | "${BUILT_PRODUCTS_DIR}/SwiftResolver/SwiftResolver.framework",
390 | );
391 | name = "[CP] Embed Pods Frameworks";
392 | outputPaths = (
393 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftResolver.framework",
394 | );
395 | runOnlyForDeploymentPostprocessing = 0;
396 | shellPath = /bin/sh;
397 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example1/Pods-Example1-frameworks.sh\"\n";
398 | showEnvVarsInLog = 0;
399 | };
400 | FF3FBA1C4373788C805DBC35 /* [CP] Copy Pods Resources */ = {
401 | isa = PBXShellScriptBuildPhase;
402 | buildActionMask = 2147483647;
403 | files = (
404 | );
405 | inputPaths = (
406 | );
407 | name = "[CP] Copy Pods Resources";
408 | outputPaths = (
409 | );
410 | runOnlyForDeploymentPostprocessing = 0;
411 | shellPath = /bin/sh;
412 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example1/Pods-Example1-resources.sh\"\n";
413 | showEnvVarsInLog = 0;
414 | };
415 | /* End PBXShellScriptBuildPhase section */
416 |
417 | /* Begin PBXSourcesBuildPhase section */
418 | 6364026E203464130075F3E7 /* Sources */ = {
419 | isa = PBXSourcesBuildPhase;
420 | buildActionMask = 2147483647;
421 | files = (
422 | 636402A6203464910075F3E7 /* AppDelegate.swift in Sources */,
423 | 636402B020347C650075F3E7 /* GithubTarget.swift in Sources */,
424 | 636402AE203479800075F3E7 /* Result.swift in Sources */,
425 | 636402BA2034863B0075F3E7 /* Scheduler.swift in Sources */,
426 | 636402A5203464910075F3E7 /* RequestProvider.swift in Sources */,
427 | 636402B820347E290075F3E7 /* GithubRepositoryInformation.swift in Sources */,
428 | 636402BC20349DF10075F3E7 /* AppContainer.swift in Sources */,
429 | 636402B520347E070075F3E7 /* GithubRepository.swift in Sources */,
430 | 636402B220347CCA0075F3E7 /* DataError.swift in Sources */,
431 | 636402BE2034ADC00075F3E7 /* AuthenticationRepository.swift in Sources */,
432 | 636402AC203479660075F3E7 /* Future.swift in Sources */,
433 | 636402A4203464910075F3E7 /* GithubViewController.swift in Sources */,
434 | );
435 | runOnlyForDeploymentPostprocessing = 0;
436 | };
437 | 63640282203464130075F3E7 /* Sources */ = {
438 | isa = PBXSourcesBuildPhase;
439 | buildActionMask = 2147483647;
440 | files = (
441 | 6364028B203464130075F3E7 /* WhyTests.swift in Sources */,
442 | );
443 | runOnlyForDeploymentPostprocessing = 0;
444 | };
445 | /* End PBXSourcesBuildPhase section */
446 |
447 | /* Begin PBXTargetDependency section */
448 | 63640288203464130075F3E7 /* PBXTargetDependency */ = {
449 | isa = PBXTargetDependency;
450 | target = 63640271203464130075F3E7 /* Example1 */;
451 | targetProxy = 63640287203464130075F3E7 /* PBXContainerItemProxy */;
452 | };
453 | /* End PBXTargetDependency section */
454 |
455 | /* Begin PBXVariantGroup section */
456 | 6364029F203464910075F3E7 /* LaunchScreen.storyboard */ = {
457 | isa = PBXVariantGroup;
458 | children = (
459 | 636402A0203464910075F3E7 /* Base */,
460 | );
461 | name = LaunchScreen.storyboard;
462 | sourceTree = "";
463 | };
464 | /* End PBXVariantGroup section */
465 |
466 | /* Begin XCBuildConfiguration section */
467 | 6364028D203464130075F3E7 /* Debug */ = {
468 | isa = XCBuildConfiguration;
469 | buildSettings = {
470 | ALWAYS_SEARCH_USER_PATHS = NO;
471 | CLANG_ANALYZER_NONNULL = YES;
472 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
473 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
474 | CLANG_CXX_LIBRARY = "libc++";
475 | CLANG_ENABLE_MODULES = YES;
476 | CLANG_ENABLE_OBJC_ARC = YES;
477 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
478 | CLANG_WARN_BOOL_CONVERSION = YES;
479 | CLANG_WARN_COMMA = YES;
480 | CLANG_WARN_CONSTANT_CONVERSION = YES;
481 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
482 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
483 | CLANG_WARN_EMPTY_BODY = YES;
484 | CLANG_WARN_ENUM_CONVERSION = YES;
485 | CLANG_WARN_INFINITE_RECURSION = YES;
486 | CLANG_WARN_INT_CONVERSION = YES;
487 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
488 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
489 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
490 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
491 | CLANG_WARN_STRICT_PROTOTYPES = YES;
492 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
493 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
494 | CLANG_WARN_UNREACHABLE_CODE = YES;
495 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
496 | CODE_SIGN_IDENTITY = "iPhone Developer";
497 | COPY_PHASE_STRIP = NO;
498 | DEBUG_INFORMATION_FORMAT = dwarf;
499 | ENABLE_STRICT_OBJC_MSGSEND = YES;
500 | ENABLE_TESTABILITY = YES;
501 | GCC_C_LANGUAGE_STANDARD = gnu11;
502 | GCC_DYNAMIC_NO_PIC = NO;
503 | GCC_NO_COMMON_BLOCKS = YES;
504 | GCC_OPTIMIZATION_LEVEL = 0;
505 | GCC_PREPROCESSOR_DEFINITIONS = (
506 | "DEBUG=1",
507 | "$(inherited)",
508 | );
509 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
510 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
511 | GCC_WARN_UNDECLARED_SELECTOR = YES;
512 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
513 | GCC_WARN_UNUSED_FUNCTION = YES;
514 | GCC_WARN_UNUSED_VARIABLE = YES;
515 | IPHONEOS_DEPLOYMENT_TARGET = 11.2;
516 | MTL_ENABLE_DEBUG_INFO = YES;
517 | ONLY_ACTIVE_ARCH = YES;
518 | SDKROOT = iphoneos;
519 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
520 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
521 | };
522 | name = Debug;
523 | };
524 | 6364028E203464130075F3E7 /* Release */ = {
525 | isa = XCBuildConfiguration;
526 | buildSettings = {
527 | ALWAYS_SEARCH_USER_PATHS = NO;
528 | CLANG_ANALYZER_NONNULL = YES;
529 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
530 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
531 | CLANG_CXX_LIBRARY = "libc++";
532 | CLANG_ENABLE_MODULES = YES;
533 | CLANG_ENABLE_OBJC_ARC = YES;
534 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
535 | CLANG_WARN_BOOL_CONVERSION = YES;
536 | CLANG_WARN_COMMA = YES;
537 | CLANG_WARN_CONSTANT_CONVERSION = YES;
538 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
539 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
540 | CLANG_WARN_EMPTY_BODY = YES;
541 | CLANG_WARN_ENUM_CONVERSION = YES;
542 | CLANG_WARN_INFINITE_RECURSION = YES;
543 | CLANG_WARN_INT_CONVERSION = YES;
544 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
545 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
546 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
547 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
548 | CLANG_WARN_STRICT_PROTOTYPES = YES;
549 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
550 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
551 | CLANG_WARN_UNREACHABLE_CODE = YES;
552 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
553 | CODE_SIGN_IDENTITY = "iPhone Developer";
554 | COPY_PHASE_STRIP = NO;
555 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
556 | ENABLE_NS_ASSERTIONS = NO;
557 | ENABLE_STRICT_OBJC_MSGSEND = YES;
558 | GCC_C_LANGUAGE_STANDARD = gnu11;
559 | GCC_NO_COMMON_BLOCKS = YES;
560 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
561 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
562 | GCC_WARN_UNDECLARED_SELECTOR = YES;
563 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
564 | GCC_WARN_UNUSED_FUNCTION = YES;
565 | GCC_WARN_UNUSED_VARIABLE = YES;
566 | IPHONEOS_DEPLOYMENT_TARGET = 11.2;
567 | MTL_ENABLE_DEBUG_INFO = NO;
568 | SDKROOT = iphoneos;
569 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
570 | VALIDATE_PRODUCT = YES;
571 | };
572 | name = Release;
573 | };
574 | 63640290203464130075F3E7 /* Debug */ = {
575 | isa = XCBuildConfiguration;
576 | baseConfigurationReference = C5B56A3EC3DE7AEE8AEC52E0 /* Pods-Example1.debug.xcconfig */;
577 | buildSettings = {
578 | CODE_SIGN_STYLE = Automatic;
579 | DEVELOPMENT_TEAM = X36AT7C9SA;
580 | INFOPLIST_FILE = "$(SRCROOT)/Example1/Assets/Info.plist";
581 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
582 | PRODUCT_BUNDLE_IDENTIFIER = br.com.swiftresolver.Example1;
583 | PRODUCT_NAME = "$(TARGET_NAME)";
584 | SWIFT_VERSION = 4.0;
585 | TARGETED_DEVICE_FAMILY = "1,2";
586 | };
587 | name = Debug;
588 | };
589 | 63640291203464130075F3E7 /* Release */ = {
590 | isa = XCBuildConfiguration;
591 | baseConfigurationReference = 20C94F250E48B7BA5BDB5DBE /* Pods-Example1.release.xcconfig */;
592 | buildSettings = {
593 | CODE_SIGN_STYLE = Automatic;
594 | DEVELOPMENT_TEAM = X36AT7C9SA;
595 | INFOPLIST_FILE = "$(SRCROOT)/Example1/Assets/Info.plist";
596 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
597 | PRODUCT_BUNDLE_IDENTIFIER = br.com.swiftresolver.Example1;
598 | PRODUCT_NAME = "$(TARGET_NAME)";
599 | SWIFT_VERSION = 4.0;
600 | TARGETED_DEVICE_FAMILY = "1,2";
601 | };
602 | name = Release;
603 | };
604 | 63640293203464130075F3E7 /* Debug */ = {
605 | isa = XCBuildConfiguration;
606 | baseConfigurationReference = 78ADD8256CCE1393E034913E /* Pods-Example1Tests.debug.xcconfig */;
607 | buildSettings = {
608 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
609 | BUNDLE_LOADER = "$(TEST_HOST)";
610 | CODE_SIGN_STYLE = Automatic;
611 | DEVELOPMENT_TEAM = X36AT7C9SA;
612 | INFOPLIST_FILE = Example1Tests/Info.plist;
613 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
614 | PRODUCT_BUNDLE_IDENTIFIER = br.com.swiftresolver.Example1Tests;
615 | PRODUCT_NAME = "$(TARGET_NAME)";
616 | SWIFT_VERSION = 4.0;
617 | TARGETED_DEVICE_FAMILY = "1,2";
618 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example1.app/Example1";
619 | };
620 | name = Debug;
621 | };
622 | 63640294203464130075F3E7 /* Release */ = {
623 | isa = XCBuildConfiguration;
624 | baseConfigurationReference = 0C46D1F634FE1F416403BA90 /* Pods-Example1Tests.release.xcconfig */;
625 | buildSettings = {
626 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
627 | BUNDLE_LOADER = "$(TEST_HOST)";
628 | CODE_SIGN_STYLE = Automatic;
629 | DEVELOPMENT_TEAM = X36AT7C9SA;
630 | INFOPLIST_FILE = Example1Tests/Info.plist;
631 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
632 | PRODUCT_BUNDLE_IDENTIFIER = br.com.swiftresolver.Example1Tests;
633 | PRODUCT_NAME = "$(TARGET_NAME)";
634 | SWIFT_VERSION = 4.0;
635 | TARGETED_DEVICE_FAMILY = "1,2";
636 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example1.app/Example1";
637 | };
638 | name = Release;
639 | };
640 | /* End XCBuildConfiguration section */
641 |
642 | /* Begin XCConfigurationList section */
643 | 6364026D203464130075F3E7 /* Build configuration list for PBXProject "Example1" */ = {
644 | isa = XCConfigurationList;
645 | buildConfigurations = (
646 | 6364028D203464130075F3E7 /* Debug */,
647 | 6364028E203464130075F3E7 /* Release */,
648 | );
649 | defaultConfigurationIsVisible = 0;
650 | defaultConfigurationName = Release;
651 | };
652 | 6364028F203464130075F3E7 /* Build configuration list for PBXNativeTarget "Example1" */ = {
653 | isa = XCConfigurationList;
654 | buildConfigurations = (
655 | 63640290203464130075F3E7 /* Debug */,
656 | 63640291203464130075F3E7 /* Release */,
657 | );
658 | defaultConfigurationIsVisible = 0;
659 | defaultConfigurationName = Release;
660 | };
661 | 63640292203464130075F3E7 /* Build configuration list for PBXNativeTarget "Example1Tests" */ = {
662 | isa = XCConfigurationList;
663 | buildConfigurations = (
664 | 63640293203464130075F3E7 /* Debug */,
665 | 63640294203464130075F3E7 /* Release */,
666 | );
667 | defaultConfigurationIsVisible = 0;
668 | defaultConfigurationName = Release;
669 | };
670 | /* End XCConfigurationList section */
671 | };
672 | rootObject = 6364026A203464130075F3E7 /* Project object */;
673 | }
674 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Assets/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Assets/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Assets/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIRequiredDeviceCapabilities
26 |
27 | armv7
28 |
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/AppContainer.swift:
--------------------------------------------------------------------------------
1 | import SwiftResolver
2 |
3 | struct AppDependencies {
4 | // list any depedencies needed to register classes
5 | }
6 |
7 | final class AppContainer {
8 | private let container = Container()
9 |
10 | init(dependencies: AppDependencies) {
11 | self.registerWith(dependencies: dependencies)
12 | }
13 |
14 | func resolve() -> T {
15 | return self.container.resolve()
16 | }
17 |
18 | private func registerWith(dependencies: AppDependencies) {
19 | self.container.register { RequestProvider() }
20 |
21 | self.container.register { GithubRepository(requestProvider: $0) }
22 |
23 | self.container.register { AuthenticationRepository(requestProvider: $0) }
24 |
25 | self.container.register { GithubViewController(githubRepository: $0, authRepository: $1) }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | @UIApplicationMain
4 | class AppDelegate: UIResponder, UIApplicationDelegate {
5 |
6 | var window: UIWindow?
7 |
8 | func application(_ application: UIApplication,
9 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
10 |
11 | let window = UIWindow(frame: UIScreen.main.bounds)
12 | self.window = window
13 |
14 | let container = AppContainer(dependencies: AppDependencies())
15 | let viewController = container.resolve() as GithubViewController
16 | window.rootViewController = viewController
17 | window.makeKeyAndVisible()
18 |
19 | return true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/Home/GithubViewController.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | final class GithubViewController: UIViewController {
4 | private let githubRepository: GithubRepository
5 | private let authRepository: AuthenticationRepository
6 |
7 | init(githubRepository: GithubRepository, authRepository: AuthenticationRepository) {
8 | self.githubRepository = githubRepository
9 | self.authRepository = authRepository
10 | super.init(nibName: nil, bundle: nil)
11 | }
12 |
13 | required init?(coder aDecoder: NSCoder) { fatalError("Not implemented") }
14 |
15 | override func viewDidLoad() {
16 | super.viewDidLoad()
17 | self.view.backgroundColor = .white
18 | self.loadData()
19 | }
20 |
21 | private func loadData() {
22 | self.githubRepository.repositories()
23 | .observeOn(MainScheduler.instance)
24 | .onNext { result in
25 | switch result {
26 | case .success(let repositories):
27 | print("repos: \(repositories)")
28 | case .error(let error):
29 | print(error.localizedDescription)
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/Model/GithubRepositoryInformation.swift:
--------------------------------------------------------------------------------
1 | struct GithubRepositoryInformation: Decodable {
2 | let name: String
3 | }
4 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/Repository/AuthenticationRepository.swift:
--------------------------------------------------------------------------------
1 | final class AuthenticationRepository {
2 | private let requestProvider: RequestProvider
3 |
4 | init(requestProvider: RequestProvider) {
5 | self.requestProvider = requestProvider
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/Repository/GithubRepository.swift:
--------------------------------------------------------------------------------
1 | final class GithubRepository {
2 | private let requestProvider: RequestProvider
3 |
4 | init(requestProvider: RequestProvider) {
5 | self.requestProvider = requestProvider
6 | }
7 |
8 | func repositories() -> Future<[GithubRepositoryInformation]> {
9 | return self.requestProvider.get(GithubTarget.all)
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/DataError.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | enum DataError: Swift.Error {
4 | case invalidTarget(TargetType)
5 | }
6 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/Future.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | final class Future {
4 | typealias Callback = (Result) -> Void
5 | private var onNext: Callback?
6 |
7 | init(configuration: (@escaping Callback) -> Void) {
8 | configuration { value in
9 | self.onNext?(value)
10 | }
11 | }
12 |
13 | func onNext(_ callback: @escaping Callback) {
14 | self.onNext = callback
15 | }
16 | }
17 |
18 | extension Future {
19 | static func error(_ error: Swift.Error) -> Future {
20 | return Future { observer in
21 | observer(.error(error))
22 | }
23 | }
24 | }
25 |
26 | extension Future {
27 | func observeOn(_ scheduler: Scheduler) -> Future {
28 | return Future { observer in
29 | self.onNext { result in
30 | scheduler.run {
31 | observer(result)
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
38 | extension Future {
39 | func map(transform: @escaping (T) throws -> B) -> Future {
40 | return Future { observer in
41 | self.onNext { result in
42 | switch result {
43 | case .success(let value):
44 | do {
45 | observer(.success(try transform(value)))
46 | } catch {
47 | observer(.error(error))
48 | }
49 | case .error(let error):
50 | observer(.error(error))
51 | }
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/GithubTarget.swift:
--------------------------------------------------------------------------------
1 | struct GithubTarget: TargetType {
2 | let url: String
3 |
4 | static var all: GithubTarget {
5 | return GithubTarget(url: "https://api.github.com/repositories")
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/RequestProvider.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | protocol TargetType {
4 | var url: String { get }
5 | }
6 |
7 | final class RequestProvider {
8 | func get(_ target: TargetType) -> Future {
9 | return self.request(target).map { data in
10 | try JSONDecoder().decode(Model.self, from: data)
11 | }
12 | }
13 |
14 | private func request(_ target: TargetType) -> Future {
15 | guard let url = URL(string: target.url) else {
16 | return Future.error(DataError.invalidTarget(target))
17 | }
18 |
19 | return Future { observer in
20 | let session = URLSession(configuration: .default)
21 | session.dataTask(with: url) { (data, urlResponse, error) in
22 | if let data = data {
23 | observer(.success(data))
24 | } else if let error = error {
25 | observer(.error(error))
26 | }
27 | }.resume()
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/Result.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | enum Result {
4 | case success(T)
5 | case error(Swift.Error)
6 | }
7 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1/Classes/RequestProvider/Scheduler.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | protocol Scheduler {
4 | func run(_ block: @escaping () -> Void) -> Void
5 | }
6 |
7 | final class MainScheduler: Scheduler {
8 | static let instance = MainScheduler()
9 | func run(_ block: @escaping () -> Void) {
10 | DispatchQueue.main.async {
11 | block()
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorial/Example1/Example1Tests/WhyTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WhyTests.swift
3 | // WhyTests
4 | //
5 | // Created by Vinicius Alves Rodrigues on 2/14/18.
6 | // Copyright © 2018 SwiftResolver. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import Why
11 |
12 | class WhyTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/tutorial/Example1/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, '9.0'
3 |
4 | target 'Example1' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | pod 'SwiftResolver', :path => '../..'
9 |
10 | target 'Example1Tests' do
11 | inherit! :search_paths
12 | # Pods for testing
13 | end
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/tutorial/Example1/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SwiftResolver (1.0.8)
3 |
4 | DEPENDENCIES:
5 | - SwiftResolver (from `../..`)
6 |
7 | EXTERNAL SOURCES:
8 | SwiftResolver:
9 | :path: ../..
10 |
11 | SPEC CHECKSUMS:
12 | SwiftResolver: 1214ca04d2c0667d63559f878a0b2d3511c1309e
13 |
14 | PODFILE CHECKSUM: 346fb8736263e61765b59f59cbd1928392f1a312
15 |
16 | COCOAPODS: 1.4.0
17 |
--------------------------------------------------------------------------------
/tutorial/Example1/README.md:
--------------------------------------------------------------------------------
1 | # Example 1
2 |
3 | This is a project example of the concepts described in the [wiki](https://github.com/viniciusaro/SwiftResolver/wiki) page.
--------------------------------------------------------------------------------