hmlongco / Factory

A new approach to Container-Based Dependency Injection for Swift and SwiftUI.
MIT License
1.7k stars 107 forks source link

is it possible to inject swiftui view through factory? #176

Closed abdahad1996 closed 6 months ago

abdahad1996 commented 6 months ago

so is something like this possible?

Screenshot 2024-01-07 at 01 33 45
hmlongco commented 6 months ago

Don't know why you'd want to, as injection should really be confined to view models and services. Attempting to do so usually ends up where you are due to the associated type problem.

If, for some reason you feel you must inject a view you're probably going to need to use AnyView to type erase the associated body type.