Last active
November 24, 2018 16:01
-
-
Save jaiversin/8c98d25d7831afebdca7ac7be437f8a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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