Marcus Leon
Marcus Leon

Reputation: 56699

Swift: Present UIAlertController in closure

We are trying to present a UIAlertController from within a closure but get the error "Implicit use of self in closure, use self. to make capture semantics specific". What exactly is the correct syntax here?

enter image description here

Upvotes: 1

Views: 564

Answers (1)

Andy Ibanez
Andy Ibanez

Reputation: 12254

You need to refer to "self" explicitly when talking about your object's instance variables inside a block.

self.showViewController(...)

Upvotes: 3

Related Questions