swiftui zstack are not fully centered

62 Views Asked by At

My code is as bellow:

struct Clock10View: View {
    let light: Bool
    var body: some View {
        ZStack() {
            Rectangle()
                .frame(width: 6, height: 6)
                .foregroundColor(.gray)
            Rectangle()
                .frame(width: 5, height: 5)
                .foregroundColor(.red)
        }
    }
}

I copied a screenshot of the simulator to Figma, enlarged it, and found that the center points of the two Rectangle were not completely aligned.

enter image description here

How do I need to align the two blocks completely?

0

There are 0 best solutions below