Skip to content

MKCoordinateRegion Binding warning #1576

Answered by tgrapperon
inwoodev asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @inwoodev! This is a vanilla bug with SwiftUI that is unfortunately present even in Xcode 14.1RC2. For example, the following idiomatic example raises a similar warning.

class Model: ObservableObject {
  @Published var region = MKCoordinateRegion(
    center: .init(),
    span: .init(latitudeDelta: 180, longitudeDelta: 180)
  )
}
struct ContentView: View {
  @StateObject var model = Model()
  var body: some View {
    Map(coordinateRegion: $model.region)
  }
}

There was recently a bug with SwiftUI where, in a few situations, some UIKit wrappers were not properly awaiting for body to finish to publish changes, which triggered the warning when the setter part of the binding was activate…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tgrapperon
Comment options

@inwoodev
Comment options

Answer selected by inwoodev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
apple bug Something isn't working due to a bug on Apple's platforms.
2 participants