The following code does not compile:
class object {
class var myVar: String! {
return "from class"
}
var myVar: String! {
return "from instance"
}
}
Error:
Invalid redeclaration of 'myVar'
Is this not possible with Swift or am I doing it wrong? This is totally legal in Objective-C (as functions rather than variables).
See Question&Answers more detail:os