Closed statusunknown418 closed 1 year ago
update: I got Injection to work by adding
import Inject
struct View {
@ObserveInjection var inject
...
.enableInjection()
}
however I'm still unable to make it work globally with the @_exported
which is what I actually want
Hi, @_exported import Inject
is just to make @ObserveInjection
and .enableInjection()
symbols available globally to your Swift code. Unfortunately, you have to add these to every View
struct in your application that you want to be able to inject either manually or using the Prepare Project
feature of the Injection.app
.
@johnno1962 thanks I understand, and in any case those dependancies and code will be stripped out in production builds right?
Yes, the code isn't stripped out but it optimises down to a no-operation for a Release build.
The Readme doesn't really explain how to setup Inject to watch all files in a project.
Where should this be used? it says on targets but I'm not sure if under .xcodeproj or where. Any help is appreciated, SwiftUI beginner here.
Prepare project
-Add patch
option