Search code examples
iosswiftuipicker

What can cause segmented Picker controls to "pop" rather than slide to the new selection, only on actual device?


My project has several Picker controls with .pickerStyle(SegmentedPickerStyle()). Something in the project (or, perhaps, on my iPad) has evidently changed, and now all of the pickers "pop" when selected, rather than the selection highlight sliding to the new selection -- but only on the actual device. In the simulator, the selection slides as expected. Even a plain vanilla picker with code straight out of Hacking With Swift exhibits this behavior on my device, so it seems that the issue is somewhere that has global effect, rather than in the code for an individual picker itself. (That "vanilla" code, along with all my other Picker controls, look normal in the Simulator.)

Other UI elements animate normally on the device, so it isn't a blanket "turn off all animations" setting, but the various segmented pickers are all affected, even though they reside in different parts of the project. (And, yes, the project is way, way too big to post all of the code -- but "the code" works as expected in the simulator.)

What are the sorts of things -- in a project or in a device's settings -- that can globally cause all segmented Pickers in a project to stop animating (though only on the device itself)?

What I'm seeing on the iPad:

selection snaps to the new choice

What I'm seeing on the Simulator (i.e. what I expect to see):

selection SLIDES to the new choice

I recognized the simulator vs device distinction when I created a Simulator to exactly duplicate my iPad (Air gen 3, iOS 14.2), and the simulator shows the picker sliding (i.e. the bottom screen capture). But the device shows it popping (the top screencap). This behavior persists after deleting the app on the iPad, rebooting the iPad, and installing the app again. So perhaps the 'guilty' setting is on the device rather than in the project???

What settings, in the project or the device, could cause this change in behavior?

Possibly related:

(( And yes, there are plenty of cases where the simulator performs poorly & the device performs well... that's understandable. This case is one where things are the other way around: what works on the simulator does NOT work as advertised on the device. ))


Solution

  • This is caused by the Reduce Motion setting on your physical device. This can be found under Settings -> Accessibility -> Motion.

    When reduced motion is disabled, the segmented picker has a slide animation.

    When reduced motion is enabled, the segmented picker does not have the slide animation.