mapbox / mapbox/mapbox-maps-ios

SwiftUI - Stuttering Zoom Animation

Open
#2,246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Xcode version: 16.0
- iOS version: 18.0
- Devices affected: Simulator
- Maps SDK Version: v11.7.0

## Observed behavior and steps to reproduce

I changed SimpleMapExample like this and observe a strange "stuttering" Zoom Animation when taping on the map

@available(iOS 14.0, *)
struct SimpleMapExample: View {
@Environment(\.colorScheme) var colorScheme
@State var isEnlarged: Bool = false

var body: some View {
let polygon = Polygon(center: .helsinki, radius: 10000, vertices: 30)
VStack {
HStack {
Spacer()
Map(initialViewport: .overview(geometry: polygon))
.mapStyle(.standard(lightPreset: colorScheme == .light ? .day : .dusk))
.frame(width: isEnlarged ? 390 : 100, height: isEnlarged ? 750 : 100)
.onTapGesture {
withAnimation (.linear(duration: 5)) {
self.isEnlarged.toggle()
}
}
}
Spacer()
}
}
}

## Expected behavior

Smooth linear animation

## Notes / preliminary analysis

## Additional links and references

https://github.com/user-attachments/assets/a34e365c-37cb-483c-8c2e-039457c32f3d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided SimpleMapExample and reproduce the zoom animation on the simulator using Xcode 16, iOS 18, and Maps SDK v11.7.0. Focus on the Map frame change triggered by onTapGesture and compare it with the expected smooth linear animation. Done means the map resizes without stuttering during the five-second animation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.