-
Notifications
You must be signed in to change notification settings - Fork 186
Open
Labels
SwiftUIIssues and features related to SwiftUI support.Issues and features related to SwiftUI support.bug 🪲Something is broken!Something is broken!
Description
Environment
- Xcode version: 16.4
- iOS version: 18.6
- Devices affected: any
- Maps SDK Version: 11.14.0
Observed behavior and steps to reproduce
MapContent does not react to @Observable
state updates. Here's the minimal test case:
@Observable
class TestViewModel {
var pluckBearing = false
}
struct MapTestContent: MapContent {
let viewModel: TestViewModel
var body: some MapContent {
if viewModel.pluckBearing {
Puck2D(bearing: .heading)
} else {
Puck2D(bearing: .none)
}
}
}
struct MapTest: View {
let viewModel = TestViewModel()
var body: some View {
VStack {
Map {
MapTestContent(viewModel: viewModel)
}
Button("Toggle Puck Bearing") {
viewModel.pluckBearing.toggle()
}
}
}
}
Tapping the button has currently no effect.
Expected behavior
Tapping the button should update pluck style. So, I'd expect MapContent
get re-evaluated when @Observable
state is updated.
Notes / preliminary analysis
The ability to update only the leaf nodes of the map declaration tree could lead to significant performance improvements.
Metadata
Metadata
Assignees
Labels
SwiftUIIssues and features related to SwiftUI support.Issues and features related to SwiftUI support.bug 🪲Something is broken!Something is broken!