title: Swift UICollectionView horizontal scroll not working
body: <p>I have an issue with a <code>UICollectionView</code> that doesn't want to scroll horizontally.  I want to show 5 cells that I can scroll between.  What is preventing my <code>collectionview</code> from scrolling?</p>
  
  <pre><code>import UIKit
  
  class FeaturedCell: UICollectionViewCell, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout 
  {
  // Attributes
  lazy var featuredVideos = UICollectionView(frame: .zero)
  
  // Superclass initializer
  required init?(coder aDecoder: NSCoder)
  {
      fatalError("init(coder:) has not been implemented")
  }
  
  // Custom initializer
  required override init(frame: CGRect)
  {
      super.init(frame: frame)
  
      let layout = UICollectionViewFlowLayout()
      layout.scrollDirection = .Horizontal
      featuredVideos = UICollectionView(frame: self.frame, collectionViewLayout: layout)
      featuredVideos.dataSource = self
      featuredVideos.delegate = self
  
      // Setting the collection view's scrolling behaviour
      featuredVideos.pagingEnabled = true
      featuredVideos.scrollEnabled = true
      featuredVideos.setContentOffset(CGPoint(x: 0,y: 0), animated: true)
  
      featuredVideos.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "cellId")
  
      addSubview(featuredVideos)
      setConstraints("H:|[v0(\(frame.width))]|", subviews: featuredVideos)
      setConstraints("V:|[v0(345)]", subviews: featuredVideos)
  }
  
  func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
      return 5
  }
  
  func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell
  {
      let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cellId", forIndexPath: indexPath)
      if indexPath.item == 1 { cell.backgroundColor = .lightGrayColor() } else { cell.backgroundColor = .brownColor() }
      return cell
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -&gt; CGSize
  {
      return CGSizeMake(frame.width/3, frame.height)
  }
  
  func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAtIndex section: Int) -&gt; CGFloat
  {
      return 10
  }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/SDwUm.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SDwUm.gif" alt="simulator view"></a></p>
  
  <p>Edit : UICollectionView actually doesn't react to any interaction, i tried "didSelectAtIndexPath", doesn't trigger.</p>