dimanche 23 octobre 2022

How could I create a matrix grid layout with lines for a view?

How could I create a view that has a matrix grid layout starting from the center and extending to the bottom. Im not allowed to post pictures yet but it would look like this ->

Matrix Graph Layout

Everything I have looked up shows me fancy grids. But I am looking for something more simple, kind of like this

            Rectangle()
                .fill(AppColor.purpleBackGroundLines)
                .frame(width: .infinity , height: 1, alignment: .center)

            Rectangle()
                .fill(AppColor.purpleBackGroundLines)
                .frame(width: .infinity , height: 1)
                .padding(.top)

but by adding lots of rectangles and paddings, it keeps pushing my center rectangle higher and I want it to have a fixed center position. I also would like to customize how much padding there is in between each line with no pushing, and if it can be absolute in every screen no matter the dimension. Is there an efficient way of doing this? Thank you.

Aucun commentaire:

Enregistrer un commentaire