You will have to rely on a static variable. so change the @State to static.
I previously noticed that @State was not enough, cause it seems the main render cycle of @State. Consider my example that has one issue with it.
@State var canExecuteOnDisappear = false
modalContent
.zIndex(1)
.onAppear {
canExecuteOnDisappear = true
}
.onDisappear {
// HACK: onDisappear fires multiple times for some reason
if canExecuteOnDisappear {
print("CDM onDisappear")
canExecuteOnDisappear = false
}
}
if I were to go through 4 different types of modal content for each content in an array. presenting another sheet after dismissing the previous one I get the behavior:
("CDM onDisappear") gets printed 3 times just fine, and then the last time it prints out 3 instead of 1 so in total 7.
CDM onDisappear
CDM onDisappear
CDM onDisappear
CDM onDisappear
CDM onDisappear
CDM onDisappear
CDM onDisappear
So change that to a static variable so it updates immediately and not on the main thread.
- @State var canExecuteOnDisappear = false
+ static var canExecuteOnDisappear = false
this fixes this issue.
Post
Replies
Boosts
Views
Activity
Yes you do nee apple developer account in order to generate identifiers, certificates and apps.
I am getting similar issue. numberOfItemsInSection is being called and is returning 2, in my case. but cellForItemAt is not being called.
Use a scrollview and set the scroll position. scroll views I have seen go behind the notice and navigation bars.
I believe I had my project set up for armv7 development and I opened up Xcode using Rosetta on accident. I dechecked the box, and restarted Xcode.
This solved my problem without adding any entries into the excluded build arches.
Monterey / Apple Silicon
but what does this feature "universal control" do, or how would you like to use it?
so it still doesnt show up on the bottom when you |> Continue program execution? or it does show up on mac and it was just a breakpoint you forgot was set on the line?
It says its auto generated, which it is after you make the intent. its not hidden in the xcode binary. for instance, i made a .intentdefinition file and created a custom intent called NoteConfiguration, save, close and open xcode and then the class NoteConfigurationIntent is made, as well as the protocol NoteConfigurationIntentHandling is then made. hope that helps.