Hello, I am new to swift programming and I've been having this error "Escaping closure captures mutating 'self' parameter" at the first live of the code block that I don't know how to solve any help will be appreciated.
Thank you!
let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data else {return}
do {
let JSONData = try JSONDecoder().decode([Memories].self, from: data)
var Count = 0
var List: [Card] = []
for Data in JSONData
{
List.append(Card(id: Count, Image: Data.Image, Date: Data.Date, Description: Data.Description, expand: false))
Count = Count + 1
}
Data_List = List
} catch {
let error = error
print(String(describing: error))
}
}
task.resume()