[ad_1]
I’ve a button arrange in ContentView with the modifiers: padding, background, font and foregroundColor.
However when it runs on the simulator, that is what occurs to the button:
Any concept on the way to clear up this? The code is as follows:
import SwiftUI
struct ContentView: View {
@State var leftDiceNo = 1
@State var rightDiceNo = 1
var physique: some View {
ZStack{
Picture("background")
.resizable()
.edgesIgnoringSafeArea(.all)
VStack{
Picture("diceeLogo")
Spacer()
HStack{
DiceView(n: leftDiceNo)
DiceView(n: rightDiceNo)
}
.padding(.horizontal)
Spacer()
Button("Roll"){
leftDiceNo = Int.random(in: 1...6)
rightDiceNo = Int.random(in: 1...6)
}
.padding(5.0)
.background(Colour.pink)
.font(.system(dimension: 45))
.foregroundColor(Colour.white)
}
}
}
}
struct DiceView: View {
let n: Int
var physique: some View {
Picture("cube(n)")
.resizable()
.aspectRatio(1, contentMode: .match)
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
[ad_2]
