Escaping closure captures mutating 'self' parameter

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()

I suggest that you look for help on Swift Forums in the future. There are plenty of people there who can help you out with problems encountered with learning Swift. There's even a post topic called "Using Swift", dedicated to posts about learning language features and core Swift frameworks, among other things. Of course, there are also people on Apple developer forums who can help you out as well.

That depends on other parts of your code. Please show enough code to solve the issue.

Escaping closure captures mutating 'self' parameter
 
 
Q