Bug in the Apple SwiftUI tutorial?

In Apple's SwiftUI Tutorials: Animating Views and Transitions, toggling between "Elevation", "Heart Rate", and "Pace" in the HikeDetail view does not change the data displayed as expected, rather it slightly shifts the graph up or down.

This can be reproduced in the "Complete" version of the project offered by Apple in the "Project files" downloads, in Xcode 11.5 (11E608c). It also seems broken in the project files for subsequent tutorials.

The code looks completely right to me, and I think I had seen the expected behavior running once...can anyone help explain?

Expected:

Actual:

It looks like a bug for me. You can report it on https://feedbackassistant.apple.com/

Removing .transition(.slide) from HikeGraph.swift seems to fix it.

Terms of Service

Privacy Policy

Cookie Policy