We use Swinject 2.8.0 and 2.8.2 in our app from the pod and we see that some of our users (100-200 crashes) have problems with the app. I could not reproduce the issue any of our test devices like 20 iPhones. So the app crashes right at the first…
I have the following Swinject implementation in my app -
import Foundation
import Swinject
@propertyWrapper
struct Inject {
let wrappedValue: Component
init() {
self.wrappedValue = Resolver.shared.resolve(Component.self)
…
Modularized the project using Tuist. I made RepositoryAssembly and UseCaseAssembly on the Data module and Domain module. Assembler is located in InjectManager and runs in AppDelegate in the App module.
// InjectManager.swift
public struct…
I am new to DependencyInjection and Swinject and because of that i have question.
Let's say we have a ViewModel PersonList with a list of Person objects. We select one of the Person and pass it to PersonDetails which is something like…
This is how I register object for FirebaseMessaging:
container.register(Messaging.self) { _ in
return Messaging.messaging()
}
and then I need to use it:
container.register(NotificationSchedulerable.self) { resolver in
…
Hi I am trying to apply swinject for my IOS project and currently I have been stuck..
I have 2 part in my application
LOGIN Part
MAIN Part
Scenario is if it's logged in already when application begins
or when login is successfully done, it should…
Whenever I run this code the init() of the VCModel gets called but Swinject is not Injecting the VCModel instance to my ViewController. Can Someone Please tell me what am I doing wrong?
Error I get is:
Unexpectedly Found nil while unwrapping an…
I dont have storyboard in my app. So all my dependencies spelled out in App Delegate. I read the documentation of the Swinject and there the option is suggested:
window.rootViewController =
container.resolve(PersonViewController.self)
But in my…
I'm working my way into the injection dependency issue. Now the question arises how to use the interface segregation principle in the case of the delegate pattern? I am using the Swinject framework for dependency injection. How can I solve…
I'm developing a macOS application that only consists of a menu bar icon.
I have a xib file (MenuBarMenu.xib) with the menu and a corresponding controller(MenuBarMenuController.swift) that puts it in menubar.
I want to inject dependencies in this…
I'm trying to write a static generic method which takes a protocol as an argument and register class instance in Swinject container as a protocol resolve.
It's important that I could not register a module as a protocol it does not conforms to.
I…
Unfortunately, some libraries only have static methods to them. Is it possible to make Swinject register a type to return a type instead of an instance of a type? Makes it hard to stub out static only libraries for testing.
I'm working on a project using RxSwift + Swinject + Assembly but they are quite new to me.
I'm having a modal controller for filters selection. It uses FilterViewModel with all available filters.
I'm wondering how to pass selected filters to…
import Swinject
class GenericsAssembly: Assembly {
func assemble(container: Container) {
container.register(TabBarController.self) { resolver in
let split1 = resolver.resolve(SplitViewController.self)!
let split2…