Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Feature: automatic injection#43

Open
Przytua wants to merge 10 commits intoApplauseArchives:masterfrom
Przytua:feature/automatic-injection
Open

Feature: automatic injection#43
Przytua wants to merge 10 commits intoApplauseArchives:masterfrom
Przytua:feature/automatic-injection

Conversation

@Przytua
Copy link
Copy Markdown
Contributor

@Przytua Przytua commented Mar 6, 2019

resolves #37

  • Updated to Swift 4.2
  • Added automatic injection by providing array of properties to inject
  • Separated initialization from Injectable protocol by adding Creatable and InjectCreatable protocols with init() and init(injector: Injecting) respectively

Copy link
Copy Markdown

@PycKamil PycKamil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, I have only spotted couple text issue that can be fixed in other PR 👍

}
```

This way when your class or struct is created via injector, shortly afterwards it receives `injectDependencies(injector:)` call. This is the place where you want to fetch your dependencies from `injector`, or dependencies are injected automatically (in case of `AutoInjectable`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing ) a the end.

injectCreatableObject = InjectCreatableClass(injector: injector)
}

it("should not have object conforming to protocol injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

expect(injectCreatableObject.objectConformingToProtocol).to(beIdenticalTo(objectConformingToProtocol))
}

it("should not have empty swift object injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

injectCreatableObject = InjectCreatableClass(injector: injector)
}

it("should not have object conforming to protocol injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

expect(injectCreatableObject.emptySwiftObject).to(beIdenticalTo(emptySwiftObject))
}

it("should have creatable object injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

injectCreatableObject = InjectCreatableClass(injector: injector)
}

it("should not have object conforming to protocol injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

expect(injectCreatableObject.objectConformingToProtocol).notTo(beNil())
}

it("should not have empty swift object injected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like either tests description is wrong or test, since they don't match

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate Reflection framework

3 participants