Okay so :
The spacing issue could be mostly in part because you have the collectionView inside the UIView. Which by the way you should only use 1 collection view and you only need 1 view controller.
1.
Just put the collection view inside the first VC and replace the UIView with the collectionView.
2.
Then just drag another prototype reusable cell into the collection view. You can have multiple custom cells in one collection view in storyboard! Make cell 1 your first custom collection view cell type and cell 2 your second. When the segment bar switches just use a function to change the data the collectionView will present when you reload the collectionView, you can change the type of cell and array the collection view will present in the UICollectionViewDatasource methods.
Something along these lines:
enum MediaTypes {
case pictures
case videos
}
fileprivate var arrayToPresent: MediaTypes = .pictures
...
func segmentChanged(){
switch self.segmentController.selectedIndex {
case 1:
self.arrayToPresent = .videos
default:
self.arrayToPresent = .pictures
}
//Logic to reload Collection View
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
switch self.arrayToPresent {
case .pictures:
let cell = collectionView.deq... as! PictureCollectionViewCell
return cell
case .videos:
let cell = collectionView.deq... as! VideoCollectionViewCell
return cell
}
}