Luciano is asking a question that's covered in 100 Days of SwiftUI.
I cannot add several names in the name part, I do not know the problem because I get an error in "Text(service.name)" can't be compiled.
Hatshushira has the correct answer. Because services is an array
, you need to extract just ONE of the items and access its String
var
. But that's not the REAL problem here.
Your code looks like you're trying to learn SwiftUI by guessing how to assemble Views
. It looks like you're guessing how to declare data models (Services). It looks like you're guessing how to link models to views.
All of these concepts are answered in the 100 Days of SwiftUI program!
So, please answer these questions. Did you start at Day 0 ? What day of the program are you on?
The answer to your question is answered first in day 18, again in day 21, 24, etc. More information is added in days 30-34. Better ways to build data models are added in later days of the program.
@Hatsushira answered just a sliver of your question, but you'll soon run into other problems. And those problems won't be solvable from desparate forum posts.
Per favore, tell us what day you are on in the 100 Days of SwiftUI course.