In completion of a fetch data, I receive a data item one by one. I want to append this item in an array and then call data, how can I do that? how I can tell to the function to wait untill all data append to the array - and the number of data is different.
self?.dataModel.fetchExportCSV(id: id, completion: { [weak self] in
switch $0 {
case .success(let data):
var arryData: [exportVO] = []
arryData.append(data)
//this is the fucntion that should be called after all the data are append to the array
createCSV(data: arryData)