Skip to content

Instantly share code, notes, and snippets.

@jaiversin
Last active November 24, 2018 16:01
Show Gist options
  • Save jaiversin/8c98d25d7831afebdca7ac7be437f8a6 to your computer and use it in GitHub Desktop.
Save jaiversin/8c98d25d7831afebdca7ac7be437f8a6 to your computer and use it in GitHub Desktop.
class Persona {
let nombre: String
var carro: Carro?
init(nombre: String) {
self.nombre = nombre
}
func transportarse() {
carro?.arrancarMotor { [weak self] in
print("\(self?.nombre ?? "") saliendo")
// Si usamos unowned, self deja de ser optional, así que el llamado sería así:
// print("\(self.nombre) saliendo")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment