Closed antranapp closed 2 years ago
I was trying to use Inject to update a SwiftUI View in a UIKit-based application, but it doesn't seem to work.
Inject
import UIKit import SwiftUI import Inject @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil ) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) let viewController = UIViewController() viewController.view.backgroundColor = .white window?.rootViewController = UIHostingController(rootView: ContentView()) window?.makeKeyAndVisible() #if DEBUG Bundle(path: "/Users/antran/Desktop/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load() #endif return true } } struct ContentView: View { var body: some View { Text("Hot Reloading") .enableInjection() } }
https://user-images.githubusercontent.com/478757/163295293-28ff2639-05df-407f-a89f-af8375235bd3.mp4
Do you have any suggestion how to make this setup working?
ah, I missed
@ObservedObject private var iO = Inject.observer
It's working now.
I was trying to use
Inject
to update a SwiftUI View in a UIKit-based application, but it doesn't seem to work.https://user-images.githubusercontent.com/478757/163295293-28ff2639-05df-407f-a89f-af8375235bd3.mp4
Do you have any suggestion how to make this setup working?