I had this exact same issue.
The compiler was confused about a weak callback with this code:
{ [weak self] in
guard let self = self else { return }
}
Using a reserved word seems to be a bad idea.
Rename the conditional variable fixed the compiler:
guard let this = self else { return }