title: Static properties in Swift
body: <p>I'm trying to convert the following Objective-C code to Swift. In my Objective-C code, there's a static variable and its accessed from a class method.</p>
  
  <pre><code>@implementation SomeClass
  
  static NSMutableArray *_items;
  
  + (void)someMethod {
      [_items removeAll];
  }
  
  @end
  </code></pre>
  
  <p>Since you can't access types declared like this <code>private var items = [AnyObject]()</code> from class functions in Swift, I created a stored property for it like this.</p>
  
  <pre><code>class var items: [AnyObject] {
      return [AnyObject]()
  }
  </code></pre>
  
  <p>And I'm trying to call a method on it from a class function like so.</p>
  
  <pre><code>class func someFunction() {
      items.removeAll(keepCapacity: false)
  }
  </code></pre>
  
  <p>But I get this error <strong>Immutable value of type '[AnyObject]' only has mutating members named 'removeAll'</strong>.</p>
  
  <p>Can anyone please tell me what's the cause of this error and how to correct it?</p>
  
  <p>Thank you.</p>