This may be a problem with my using a beta OS... I'm running MacOS Montery 12.5 beta (21G5056b) and Xcode Version 13.4.1 (13F100).
I've not been comprehensive in my attempt to debug this, but I have located a very simple example of the problem.
I create an Xcode project for AnimationSandbox and add the first set of code from the tutorial
Text("Click Me")
.onTapGesture {
// do nothing just yet
}
.padding(50)
.background(.red)
.foregroundColor(.white)
.clipShape(Circle())
.padding(100)
This works correctly in the preview - like the illustration in the tutorial - but when built and run, the text is missing. That is, I get a red circle with no text.
The problem appears to be caused by the .padding(100)
; if I comment this out
Text("Click me")
.onTapGesture {
// do nothing just yet
}
.padding(50)
.background(.red)
.foregroundColor(.white)
.clipShape(Circle())
//.padding(100)
the preview and app match (what I take to be) correctly.
OK - the problem is that if the window size of the app is too small, the text doesn't appear. If I resize the window it works correctly.
Unfortunately it's taken me a couple of hours to understand this.