title: Highlight current UICollectionViewCell tvOS
body: <p>I'm currently developing an app as a proof of concept for the appleTV. And I'm trying to show a queue. Which is separated in different departments. We've got Mac, iPhone, iPad... And I'd like to update my collectionView automatically to show which departement is showing. </p>
  
  <p>I've already succeeded to update my tableview automatically.</p>
  
  <p>Is there something don't see?</p>
  
  <p><a href="https://i.stack.imgur.com/Nn059.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nn059.jpg" alt="enter image description here"></a></p>
  
  <p>And here is the code of my controller</p>
  
  <pre><code>class QueueViewController : UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UITableViewDelegate, UITableViewDataSource {
  var departments = [Department]()
  var users = [User]()
  let dateFormatter = NSDateFormatter()
  @IBOutlet weak var collectionView: UICollectionView!
  @IBOutlet weak var tableView: UITableView!
  
  
  override func viewDidLoad() {
      print("QueueViewController")
      collectionView.delegate = self
      collectionView.dataSource = self
      self.view.backgroundColor = UIColor(patternImage: UIImage(named: "BackgroundQueue")!)
      fetchDepartments()
      dateFormatter.dateFormat = "HH:mm"
  }
  override func viewWillAppear(animated: Bool) {
      //Hier moet de fetch task worden uitgevoerd
      if departments.count &gt; 0 {
          startTimer()
      }
  }
  override func viewWillDisappear(animated: Bool) {
      stopTimer()
  }
  //MARK: - CollectionView
  func numberOfSectionsInCollectionView(collectionView: UICollectionView) -&gt; Int {
      return 1
  }
  func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return departments.count
  }
  func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! DepartmentItemCell
      let department = departments[indexPath.row]
      let title = department.name
      cell.DepartmentButton.setTitle(title, forState: .Normal)
      cell.DepartmentButton.backgroundColor = UIColor.clearColor()
      cell.DepartmentButton.restorationIdentifier = department.id
      return cell
  
  }
  func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
      print("indexpath :\(indexPath.row)")
  }
  
  @IBAction func selectDepartment(sender: AnyObject) {
      fetchQueueForDepartment(sender.restorationIdentifier!!)
  }
  
  //MARK: - TableView
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return users.count
  }
  func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      return 1
  }
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCellWithIdentifier("tableCell") as! QueueItemCell
      let user = users[indexPath.row]
  
      if indexPath.row == 0 {
          let attributes = [
              NSUnderlineStyleAttributeName : 1]
          let title = NSAttributedString(string: "\(user.firstname!) \(user.lastname!)", attributes: attributes) //1
          cell.nameLabel.attributedText = title
          return cell
  
      }
  
      cell.nameLabel.text = "\(user.firstname!) \(user.lastname!)"
      cell.arrivalLabel.text = user.arrivalDate == nil ? "" : dateFormatter.stringFromDate(user.arrivalDate!)
  
   return cell
  }
  
  //MARK: - Focus update
  override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
      super.didUpdateFocusInContext(context, withAnimationCoordinator: coordinator)
  
  
  }
  //Zorgt ervoor dat je de cellen in collectionview kan selecteren. focus op zetten
  func collectionView(collectionView: UICollectionView, canFocusItemAtIndexPath indexPath: NSIndexPath) -&gt; Bool
  {
      return false
  }
  
  //MARK: - Parse
  func fetchDepartments(){
      SVProgressHUD.show()
      ParseService.sharedInstance.fetchDepartments({
          (error, data) -&gt; () in
          if let json_data = data?["result"] {
              self.departments = DepartmentHandler.parseJson(json_data!)
              dispatch_async(dispatch_get_main_queue(), {
                  () -&gt; Void in
                  print("succeed")
                  self.collectionView.reloadData()
                  SVProgressHUD.dismiss()
                  //Eerste departement
                  self.fetchQueueForDepartment(self.departments[0].id!)
                  self.startTimer()
  
              })
          }
      })
  }
  
  func fetchQueueForDepartment(identifier: String){
      SVProgressHUD.show()
      ParseService.sharedInstance.fetchUsersPerDepartment(identifier,completion:{
          (error, data) -&gt; () in
          if let json_data = data?["result"] {
              self.users = UserHandler.parseJSon(json_data!)
              dispatch_async(dispatch_get_main_queue(), {
                  () -&gt; Void in
                  print("succeed")
                  self.tableView.reloadData()
  
                  //self.updateFocusCell()
                  SVProgressHUD.dismiss()
              })
          }
      })
  
  }
  
  
  //-----------------------------------------------
  //For the loop
  var timer: dispatch_source_t!
  var item = 0
  //MARK: - Loop fetch
  func startTimer() {
  
      let queue = dispatch_queue_create("com.icapps.caps", nil)
      timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue)
      dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 10 * NSEC_PER_SEC, 1 * NSEC_PER_SEC) // every 10 seconds, with leeway of 1 second
      dispatch_source_set_event_handler(timer) {
          // do whatever you want here
          let indexPath = NSIndexPath(forRow: self.item, inSection: 0)
          self.fetchQueueForDepartment(self.departments[indexPath.row].id!)
  
          self.collectionView.selectItemAtIndexPath(indexPath, animated: true, scrollPosition: .None)
  
  
  
          print(self.item)
          print(self.departments[indexPath.row].name!)
  
          self.item++
          if self.item == self.departments.count {
              self.item = 0
          }
  
      }
      dispatch_resume(timer)
  
  }
  
  func stopTimer() {
      if timer != nil {
          print("Stop")
          dispatch_source_cancel(timer)
          timer = nil
      }
  
  }
    }
  </code></pre>