I have a class with a nested class. I'm trying to access variables of the outer class from within the nested class:
class Thing{
var name : String?
var t = Thong()
class Thong{
func printMe(){
print(name) // error: instance member 'name' cannot be used on type 'Thing'
}
}
}
This however, gives me the following error:
instance member 'name' cannot be used on type 'Thing'
Is there an elegant way to circumvent this? I was hoping for nested classes to capture the lexical scope, as closures do.
Thanks