Hey all,
I have a complex View that sometimes it's getting re-created for some events that I do not understand. I put the _PrintChanges() in the View body, and here's what I got:
EditPageComponentControlHostView: @self, @identity, _pageController, _componentController, _hasContent changed.
struct EditPageComponentControlHostView: View {
@Environment(EditPageController.self) var pageController
@State private var componentController = EditPageComponentController()
@State private var hasContent = false
It seems like the View is being reset since the @State hasContent has been reset. It seems like if the View's @identity has changed, SwiftUI will re-create the view hence the variable _hasChanged has been reset.
So I tried:
conform EditPageComponentControlHostView to Equatable, and @identity is still changing.
Set id on EditPageComponentControlHostView like this:
EditPageComponentControlHostView()
.id("Test")
and it still changing the identity. What did I miss? Thanks!
Post
Replies
Boosts
Views
Activity
Hello, I can't seem to set any breakpoint in didSet for all properties inside Observable.
Is this a bug?
XcodeVersion 15.2
(15C500b)
Thanks!
Hello all, I'm porting my existing app to catalyst with optimized for mac option. However, I noticed the app will sometimes restore previous open windows if I previously kill it in Xcode. However, these restored windows are also just showing the app entry content instead of restoring the previous scene content. Question, is there anyway to disable this restore scene behavior? Thanks!