посмотрите, почему это происходит, попробуйте изменить свой код
var body: some View {
VStack {
List {
ForEach(dirContent, id: \.self){
fileName in
Text(fileName).onAppear {
print("item appear")
}
}
}.onAppear {
print("list appear")
}
Button("Get Data"){self.dirContent = Service.getData()}
}
.onAppear{
print("content appear")
DispatchQueue.main.async {
self.dirContent = Service.getData2()
}
}
}
отладочная печать "старой школы" показывает нам
content appear
list appear
item appear
item appear
Теперь все ясно, не правда ли