Post

Replies

Boosts

Views

Activity

Reply to Xcode 14: Publishing changes from within view updates
This code was producing the same warning: struct AreaMap: View {   @Binding var region: MKCoordinateRegion   var body: some View {     Map(coordinateRegion: $region)   } } Where region was passed in the initializer of AreaMap from its parent view. This resolved the issue: struct AreaMap: View {   @Binding var region: MKCoordinateRegion   var body: some View {     let binding = Binding(       get: { self.region },       set: { newValue in         DispatchQueue.main.async {           self.region = newValue         }       }     )     return Map(coordinateRegion: binding)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’22
Reply to SwiftUI sheet dismiss warning
OK, moving the property from the ObservedObject to become a private view @State variable solves the issue. But, it was an @Publisehd inside an ObservedObject for a reason (being calculated from other conditions for example). So, no more @Published calculated properties?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’22