Closed Dominus666 closed 1 year ago
Hi, do you have an instance variable in your View initialised to the Inject.observer
or an @ObserveInject
variable to force the redraw?
Hi, do you have an instance variable in your View initialised to the
Inject.observer
or an@ObserveInject
variable to force the redraw?
did you mean this?
Yes, @ObserveInjection, sorry. And it's still not redrawing? Do you have an @ObserveInjection in the Layout() view? They don't cascade unfortunately. Otherwise, SwiftUI caches Layout unless something in its state changes.
I use only one @ObserveInjection. views redraw only when I change ContentView
it's redrawing only in view where I add @ObserveInjection
Only views that contain an @ObserveInjection are redrawn automatically. The subview appearance is cached by SwiftUI unless you add a @ObserveInjection to the subview which lets it know if needs to redraw.
ok, thank you, it's working. and when I add @observe, should I rebuild project? because I get error
Yes, you always need to rebuild after adding an instance variable. By @ObserveInject, I meant @ObserveInjection.
ty for the help
Hi, I have issue with hot-reload. In terminal I have next message // 💉 InjectionIII connected /Users/mac/Documents/Developer/Barter(swift)/Barter(swift).xcodeproj 💉 Watching files under the directory /Users/mac/Documents/Developer/Barter(swift) // and after when I press "ctrl + s" I have next message // 💉 Compiling /Users/mac/Documents/Developer/Barter(swift)/Barter(swift)/Views/AuthViews/AuthView.swift 💉 Loading .dylib ... 💉 Interposed 3 function references. 💉 Injected type #1 'Barterswift.AuthView' 💉 Injected type #2 'Barterswift.AuthView_Previews' //
but simulator doesn't reload