Post

Replies

Boosts

Views

Activity

Escaping closure captures non-escaping parameter 'action'
Here is my code: func animateFlipCard( _ action: (() -> Void)) {         UIView.animate(withDuration: 0.5, delay: 0, options: [.autoreverse], animations: {             self.cardView.transform = CGAffineTransform(scaleX: 0.001, y: 1)             DispatchQueue.main.asyncAfter(deadline: .now() + 1) { action() }         }, completion: {_ in             self.cardView.transform = CGAffineTransform.identity         })     } I get the error "Escaping closure captures non-escaping parameter 'action'" on lines 2 and 4. What am I doing wrong and how can I fix this?
1
0
3.9k
Jun ’20