Skip to content

Commit

Permalink
opened the DIContainer properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadevs committed Jul 10, 2019
1 parent 341962d commit 2b4d368
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Binary file not shown.
8 changes: 4 additions & 4 deletions SwiftInjector/Containerable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

protocol Containerable: class {
public protocol Containerable: class {
typealias Object = AnyObject
typealias ServiceName = String
typealias Service = (() -> Object)
Expand All @@ -22,8 +22,8 @@ protocol Containerable: class {
var recursiveNotResolvedObjects: [Object] { get set }
}

struct ContainerObject {
enum RegistrationType {
public struct ContainerObject {
public enum RegistrationType {
case manual
case automatic
}
Expand All @@ -42,7 +42,7 @@ struct ContainerObject {


//MARK: TODO: MOVE IT TO DIContainer.swift
extension Containerable {
public extension Containerable {
private func resolveAny(typeString: String, name: String? = nil) -> Object? {
let array: [ContainerObject]? = {
if let filterName = name {
Expand Down
10 changes: 5 additions & 5 deletions SwiftInjector/DIContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
import Foundation

open class DIContainer: Container {
var parentContainer: Containerable
open var parentContainer: Containerable

init(parentContainer: Containerable? = nil) {
public init(parentContainer: Containerable? = nil) {
self.parentContainer = parentContainer ?? RootContainer()
self.register()
}

final func register<T: Containerable.Object>(registrationType: ContainerObject.RegistrationType = .automatic,
public final func register<T: Containerable.Object>(registrationType: ContainerObject.RegistrationType = .automatic,
name: String? = nil,
_ registration: @escaping (() -> T)) {
parentContainer.register(registration, name: name, registrationType: registrationType)
}

final func resolve<T: Containerable.Object>(name: String? = nil) -> T? {
public final func resolve<T: Containerable.Object>(name: String? = nil) -> T? {
return parentContainer.resolve(name: name)
}

func register() {
open func register() {
// Mark: leave empty only in this class
}
}
2 changes: 1 addition & 1 deletion SwiftInjectorable.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#
spec.swift_version = ['4.2', '5.0']
spec.name = "SwiftInjectorable"
spec.version = "0.0.1.3"
spec.version = "0.0.1.4"
spec.summary = "SwiftInjector - library for dependency injection, maden for convinient and fast properties connection."

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit 2b4d368

Please sign in to comment.