title: scrollToItem isn't working in my CollectionView?
body: <p>Why scrollToItem isn't working in my CollectionView? I want to work scrollToItem on <code>EnabledID</code>. So what's a problem and how fixed it?</p>
  <p><strong>Code:</strong></p>
  <pre><code>var dataArray = NSMutableArray() // dataArray is has a data from Database
  var EnabledID = Int()
  
  EnabledID = UserDefaults.standard.integer(forKey: &quot;EnabledID&quot;)
      
  if EnabledID == 0 {
          
      EnabledID = 1
      UserDefaults.standard.set(1, forKey: &quot;EnabledID&quot;)
          
  } else {
      if EnabledID &lt; dataArray.count {
          let index = NSIndexPath(item: EnabledID, section: 0)
          self.myCollectionView.scrollToItem(at: index as IndexPath, at: .centeredVertically, animated: true)
      }
  }
      
  </code></pre>