Closed sassiwalid closed 1 year ago
Hi, difficult to say without more information. Do you have an @objc func injected()
method on the ViewController which redraws when you inject by calling say, viewDidLoad()
? Looks like the code is being injected, just not called again to see the changes take effect. See the InjectionIII readme for details and information about what you need to do for SwiftUI.
Hello thank you yes it's work now. But I have many issues with embedded controllers or tableviewcell. Call to the viewdidload is insufficient
Hello again maybe a complete example will be great. this my code now. first I made an extension for UIViewController.
public extension UIViewController {
static func loadFromNib<T: UIViewController>() -> T {
Inject.ViewControllerHost(T(nibName: "\(self)", bundle: nil)) as! T
}
@objc func injected() {
viewDidLoad()
}
}
and I use viewController like this
let viewController = MyController.loadFromNib()
This work with viewController when I change every thing work. But I have a pain points with subViews like collectionViewCell, TableViewcell or any customViews. I think when I change my customcellView, injector compile only the class or struct and didn't reload the hall view. Hope, it's more clear now.
Hi, you're getting the idea now. All Injection does is re-wire your program so function bodies are replaced, it's up to the user to arrange for those bodies to be called again so they can take effect typically using the injected()
mechanism. If you come up with a clean abstraction for a common idiom that could be of use to other programmers like your loadFromNib() function file a PR and we can include it in Inject. A couple of ideas: have you explored using a class method returning type Self
instead of using a generic (though it amounts to pretty much the same)?
Hello I have an issue with the integration please. I have a multi frameworks iOS project. I installed injectorIII and I did all the configuration (other linker flags...) But when I make a change in a view controller nothing change.
I have the same issue both for UIKit and swift ui views.
Any idea please?