While trying to bind some protocols to various classes I have encountered a strange behaviour of getting nil in the protocols.
This is the dependency injector class:
class DependencyInjector: NSObject {
let container: Container
…
I'm having a headache because of this issue. Why my SplashscreenViewController doesn't deinitialize? Do you guys see any potential retain cycles in the code posted below?
I tried to check Malloc stack, but couldn't find any useful informations.…
Disclaimer: I'm still learning Swift so forgive me if I haven't understood certain concepts/capabilities/limitations of Swift.
With the Swinject framework, if you wanted to bind a protocol to a class - it seems you have to return the class instance…
I'm trying to create a function to return an array of metatypes, which I can then use to resolve instances from a Swinject Resolver. Here's my code:
protocol Task: class { }
func getTypes() -> [Task.Type] {
return [ConcreteTaskA.self,…
Let's pretend we have an UITableViewController that on didSelectRowAtSection loads an instance of a class named i.e.: ClassToInject and it wants to inject it through a property injection because our ViewControllerToBePushed has a property of…
I use swinject with swift 3.
I try to present on my current view controller, another view controller, located in a .xib file.
if I do it in a project without swinject, it works.
in my project, using swinject it crashes :
libc++abi.dylib:…
I've created a super simple protocol:
protocol IndependentProtocol {}
and service:
class IndependentService: IndependentProtocol {}
and the following Swinject registration works:
defaultContainer.register( IndependentProtocol.self )
{
_ in…
thanks for that Framework. I really like the idea and I'm eager to use it! However, I'm currently trying to get this up and running with an app that uses realm as well. I initially tought, It might be a good idea to create a realmService which I…
What is the right (cleanest and most concise) way to have PetOwner that can at any later point in program create new instances of Cat?
Let's assume that createAnotherAnimal can be called by PetOwner itself after it gets response to some async…
I'm using awesome Swinject for DI in my project, but I'm using it without assemblies (by the time I've started using Swinject, there was no assemblies).
My current pattern of using Containers is:
class ParentContainer {
private let container:…
I would like to pass an object that conforms to some protocol, and resolve its type for allocation with Swinject framwork (By dependency injection).
protocol IViewModelAware {
typealias T
var viewModel : T { get set }
}
class…
I have a SwiftUI view that uses a date picker.
I am trying to update my model via the date picker. The model is "Injected" via swinject, however I feel like something is slightly missing.
The error is:
Cannot convert value of type…
Currently i'm creating my modules like this:
final class DiscoverAssembly {
func build() -> UIViewController? {
let container = Container()
container.register(DiscoverInteractorInput.self) { (_, presenter: DiscoverPresenter)…