Saturday, January 13, 2024
HomeiOS Developmentios - Card setting into two columns SwiftUI

ios – Card setting into two columns SwiftUI


I’m making an attempt to set card view vertically into two columns.
I’ve created two views – One is Product Essential Catalog and second is for Catalog Particulars (which is the cardboard).

I attempted to name Catalog Particulars from Product Essential Catalog in keeping with information. I must show card/cell in two columns however its not displaying.

CardView

 var physique: some View {
        VStack {
            VStack(spacing: 20) {
                Picture("Image2")
                    .resizable()
                    .scaledToFit()**
                VStack {
                    Textual content("Product 1")
                        .font(.physique)
                        .fontWeight(.daring)
                        .lineLimit(2)
                        .multilineTextAlignment(.heart)
                }
                
            }
            .body(minWidth: 176, maxWidth: 176, minHeight: 176, maxHeight: 176)**
            .padding(10)
            .background(Coloration(purple: 200/255, inexperienced: 200/255, blue: 230/255))
            .cornerRadius(10)
        }
    }

Essential – I’m calling CardView right here

var physique: some View {
        VStack {
            HeaderView()
            HStack {
                ForEach(viewModel.merchandise, id: .productCode) { cat in
                    HStack {
                        CardView(kind: .mediumProductCardView(viewModel: ProductCatalogViewModel(product: cat)))
                    }
                    .body(maxWidth: .infinity)
                }
            }
        }
    }
}

struct HeaderView: View {
    var physique: some View {
        HStack {
            VStack(alignment: .heart, spacing: 5){
                Textual content("Merchandise")
                    .font(.system(.largeTitle, design:.rounded))
                    .fontWeight(.black)
                Textual content("The search for a balanced life")
                    .font(.title2)
            }
            //Spacer()
        }
    }
}

Present End result:

at present present like this

Need two columns like this:

Precise



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments