Swift UI animations seem to behave differently regarding to the animation of a View position in its parent frame for iOS 14 versus iOS 13. My goal in the code snippet below is to only animate the resizing of the button text, which should happen on tapping it. Instead, in iOS 14, the displacement of the button, which is induced by the toggled visibility of an additional View in the VStack, is also being animated.
Identical code produces different outputs in iOS 13 (Xcode 11) and iOS 14 (Xcode 12 beta 6, on macOS 11 beta). In iOS 14, how can the old behavior be reproduced?
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State var toggle = false
var body: some View {
VStack{
if self.toggle {
Rectangle().frame(width: 200, height: 200)
}
Button(action: {
self.toggle.toggle()
}){
Text("Tap me!")
.scaleEffect(self.toggle ? 2 : 1)
.animation(
Animation.easeInOut(duration: 1.5)
)
}
}
.frame(width: 400, height: 400)
}
}
PlaygroundPage.current.setLiveView(ContentView())
This is the desired behavior, as in iOS 13

This is the unwanted behavior, as in iOS 14

Note that, at least for me, the same unwanted behavior occurs not only in a Playground, but also for iOS 14 in Xcode Previews, as well as in the Simulator and on Device (see project files https://github.com/himbeles/PositionAnimationExample):
