title: NSOutlineView, using item: AnyObject
body: <p>I'm creating a <strong>NSOutlineView</strong>. When implementing the Data Source, although I'm able to create the top hierarchy I can not implement the childHierarchy. The reason is that I can't read the <strong>item: AnyObject?</strong> which prevents me from returning the right array from the dictionary. </p>
  
  <pre><code> //MARK: NSOutlineView
  var outlineTopHierarchy = ["COLLECT", "REVIEW", "PROJECTS", "AREAS"]
  var outlineContents = ["COLLECT":["a","b"], "REVIEW":["c","d"],"PROJECTS":["e","f"],"AREAS":["g","h"]]
  
  //Get the children for item
  func childrenForItem (itemPassed : AnyObject?) -&gt; Array&lt;String&gt;{
      var childrenResult = Array&lt;String&gt;()
      if(itemPassed == nil){ //If no item passed we return the highest level of hirarchy
          childrenResult = outlineTopHierarchy
      }else{ 
  
  
          //ISSUE HERE:
          //NEED TO FIND ITS TITLE to call the correct child 
          childrenResult = outlineContents["COLLECT"]!  //FAKED, should be showing the top hierarchy item so I could return the right data
  
  
      }
      return childrenResult
  }
  
  
  //Data source
  func outlineView(outlineView: NSOutlineView, child index: Int, ofItem item: AnyObject?) -&gt; AnyObject{
      return childrenForItem(item)[index]
  }
  
  func outlineView(outlineView: NSOutlineView, isItemExpandable item: AnyObject) -&gt; Bool{
      if(outlineView.parentForItem(item) == nil){
          return true
      }else{
          return false
      }
  }
  
  func outlineView(outlineView: NSOutlineView, numberOfChildrenOfItem item: AnyObject?) -&gt; Int{
      return childrenForItem(item).count
  }
  
  
  func outlineView(outlineView: NSOutlineView, viewForTableColumn: NSTableColumn?, item: AnyObject) -&gt; NSView? {
  
      // For the groups, we just return a regular text view.
      if (outlineTopHierarchy.contains(item as! String)) {
          let resultTextField = outlineView.makeViewWithIdentifier("HeaderCell", owner: self) as! NSTableCellView
          resultTextField.textField!.stringValue = item as! String
          return resultTextField
      }else{
          // The cell is setup in IB. The textField and imageView outlets are properly setup.
          let resultTextField = outlineView.makeViewWithIdentifier("DataCell", owner: self) as! NSTableCellView
          resultTextField.textField!.stringValue = item as! String
          return resultTextField
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I used this as a reference, although it's Objective-C <a href="https://developer.apple.com/library/mac/samplecode/SidebarDemo/Introduction/Intro.html" rel="nofollow">implemented</a></p>