Hello,
I am quite new to swift and therefore have some quite generall questions. I have the following code:
class Pokeman {
private var _name: String!
private var _pokedexId: Int!
var name: String {
return _name
}
var pokedexId: Int {
return _pokedexId
}
init(name: String, pokedexId: Int) {
self._name = name
self._pokedexId = pokedexId
}
}My questions are why do you use "_"? Why use private in this case? And more generally why create two almost identical variables (only difference is the underscore and the use of private)?
Thanks in advance for the help!