Questions tagged [swinject]

Dependency injection framework for Swift

Dependency injection framework for Swift

70 questions
0
votes
1 answer

Swinject: generate instances of any object (for not registered object, ViewModel, etc...)

is possible to resolve/ create a new instace of object thats are not registered in Swinject container? In Unity dependency injection for c# (from Microsoft) is it. I Want to resolve viewModel class, that have dependence for some protocols. For…
Puty
  • 100
  • 1
  • 13
0
votes
1 answer

SwinjectStoryboard container resolves different objects (instances)

I've tried Swinject(SwinjectStoryboard) and got a problem. Please help me. extension SwinjectStoryboard { @objc class func setup() { defaultContainer.register(SomeClass.self) { _ in SomeClass() } …
Ragara
  • 21
  • 5
0
votes
1 answer

How to resolve Singleton instance from two different IOC Containers

I am new to IOC, I am building an Application where we are using IOC containers while discussing we decided an architecture that each module will have two Assemblies one for all module level work which is not exposed outside of that module and one…
0
votes
1 answer

How to satisfy cocoapod external dependancy when using specific branch

In my project I'm using both Swinject and SwinjectAutoregistration pods. Both are usually declared as '2.0.0' versions like so: pod 'Swinject', '2.0.0' pod 'SwinjectAutoregistration', '2.0.0' But in order to build my project in the beta…
invalidArgument
  • 2,289
  • 4
  • 24
  • 35
0
votes
1 answer

Swinject: Using weak scope is leaking objects

I'm using Swinject for DI in my swift project. I think using weak object scope is leading to leaks. I have this dummy object protocol DevTestProtocol: class {} class DevTest: DevTestProtocol {} which is registered like follows (I'm using an…
Alexis
  • 16,629
  • 17
  • 62
  • 107
0
votes
0 answers

Swift/Swinject without Storyboards

I'm starting a new Swift project using Swinject without Storyboards. What's the pattern to inject ViewControllers into other ViewControllers to perform Segues? If you inject a child ViewController into a parent ViewController, won't the child…
Adam Young
  • 1,217
  • 10
  • 18
0
votes
1 answer

Using SwInject in conjunction with a central observer pattern

I am using SWInject to maintain dependencies in my app, and the Coordinator pattern to manage logic and dependencies. Can the SWInject be used in conjunction with a centralized push notification framework with multiple observers in different parts…
meow
  • 27,476
  • 33
  • 116
  • 177
0
votes
0 answers

Swinject: MVVM and Storyboard Setup

It is my first project using Swinject and I want to make sure I use it properly. Coming from a C++/Objective-C background, I don't have much experience with dependency injection containers. I follow the MVVM architecture, use SwinjectStoryboard and…
Yann Bodson
  • 1,634
  • 1
  • 17
  • 29
0
votes
1 answer

Swinject Testing resolved service

I am looking for a way to test if a service has already been resolved in the .Container scope. My application fires up a few "services" at launch and I wanted to make sure those services have been resolved without triggering them to be resolved.
MPiccinato
  • 101
  • 1
  • 5
-2
votes
1 answer

Swinject factory closure called multiple times when object scope is container

I'm trying to register CoreDataStack as a single instance on a shared container with object scope .container, but its factory closure called multiple times and when I debug memory graph in Xcode several instances of the object are created even when…
Ali Baqbani
  • 153
  • 1
  • 2
  • 13
1 2 3 4
5