I know that you cannot access a non-stationary class variable from a static context, but what about a different path? I have the following code:
class MyClass {
static var myArr = [String]()
func getArr() -> [String] {
return myArr
}
However, when I try to compile this, I get an error message MyClass does not have a member named myArr. I thought that static variables were visible to both static and non-stationary methods, so I don’t know where I am going wrong.
I am on a Macbook with OS X Yosemite using Xcode 6.3.
source
share