Post

Replies

Boosts

Views

Activity

Reply to SwiftUI's onAppear() and onDisappear() called multiple times and inconsistently on iOS 14.1
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’23
Reply to SwiftUI's onAppear() and onDisappear() called multiple times and inconsistently on iOS 14.1
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to MusicKit web Token
Yes you do nee apple developer account in order to generate identifiers, certificates and apps.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to CollectionView cellForItemAt never runs
I am getting similar issue. numberOfItemsInSection is being called and is returning 2, in my case. but cellForItemAt is not being called.
Replies
Boosts
Views
Activity
Jun ’22
Reply to safeAreaLayoutGuide but under navigation and tool bars
Use a scrollview and set the scroll position. scroll views I have seen go behind the notice and navigation bars.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Xcode12 build error. The linked framework 'Pods_projectA.framework'is missing one or more architectures required by this target: arm64
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
Replies
Boosts
Views
Activity
Dec ’21
Reply to Universal Control
but what does this feature "universal control" do, or how would you like to use it?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21