Home > Mobile >  How to arrange text horizontaly in a for each in SwiftUI?
How to arrange text horizontaly in a for each in SwiftUI?

Time:02-21

I'm trying to arrange a text horizontally, like a description, but I'm ending with an ugly thing. I'll post the code below, maybe someone have a clue how to fix this. Thanks !


VStack {
  HStack {
                    ForEach(meniu!.ingredients) { men in
                        let ingredient = syncViewModel.fetchByIdIngredients(ingredientId: men.ingredient)
                        if ingredient != nil {
                                Text("\(ingredient?.name ?? "" ), ")
                                    .foregroundColor(.colorGrayDark)
                        } else {
                            EmptyView()
                        }
                    }
            }

}



CodePudding user response:

This is the same question already asked enter image description here

  • Related