Post

Replies

Boosts

Views

Activity

Reply to SwiftUI MapKit - MapAnnotation - Publishing changes from within view updates is not allowed, this will cause undefined behavior.
This issue started in XCode 14 (Beta 5?) and iOS16. Nobody knows what it is, why it happens, and if it is an issue that might cause crashes or other side effects or simply a bug in XCode 14 - iOS 16. There is no advice from apple on properly handling this warning and it is not only MapKit-related (although I encountered it for the first time while playing with MapKit) but happens everywhere where you bind to a published property. Some have figured it is related to view animations (MapKit moving the map, a button fading on click, etc.). So an ugly workaround is to wrap the access to this property with a timer that delays actions until the animation ends.
Oct ’22
Reply to Mapkit and swiftui
But binding a published property to Maps and changing it anywhere in the code gives this bloody [SwiftUI] Publishing changes from within view updates is not allowed, this will cause undefined behavior. warning on iOS 16, XCode 14...
Oct ’22