SwiftUI Button().frame()

macOS Project

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)

Target: x86_64-apple-darwin19.3.0


struct ContentView: View {

@State private var newSetState = true

var body: some View {

VStack {

HStack {

if self.newSetState {

Text(...

.

.

.

}

}.font(.largeTitle).lineLimit(1).padding().fixedSize()


HStack {

if self.newSetState {

Text( ...

.

.

.

}

}.font(.largeTitle).lineLimit(1).padding().fixedSize()

Button(LocalizedStringKey("🔄"), action: { self.newSetState.toggle(); self.newSetState.toggle() } )

.frame(width: 36, height: 36, alignment: .center)

}

}

}


Button functions, i.e., causes body to cycle again, but I cannot change its size. If set to .font(.largeTitle) as the Text that procedes it, the emoji gets its top truncated, even if frame is 136x136. (attempted to paste .png here, rejected). Apennding .scaledToFill() or .scaledToFit() does nothing.


If I should post a bug to Apple, please post a url "how to:".

SwiftUI Button().frame()
 
 
Q