SwifUI loop over strings to add item

Viewed 34

I got an array of strings, doing a VStack to make them vertically, I'm trying for each item to add an image in the beginning of the first Char, my code is working,

the only problem is the checkmark image is not aligned.

it should be simple and as the code is executed, the image should be in the beginning of the string, what's the problem?

     VStack(alignment: .leading){
                ForEach(features, id:\.self){ description in
                    HStack{
                        GCheckmark()
                        Text(description).fixedSize(horizontal: false, vertical: true)
                            
                    }
                }
            }

Example

1 Answers

It can be done with alignment, like

HStack(alignment: .top) {       // << here !!
    GCheckmark()
    Text(description).fixedSize(horizontal: false, vertical: true)
        .gistFont(.body)
}
Related