<commit_before>//
//  ViewController.swift
//  ShazamDiscover
//
//  Created by <NAME> on 11/07/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    fileprivate var cellSize: CGSize?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupCollectionView()
        setupScrollView()
    }
}

extension ViewController: UICollectionViewDelegate, UICollectionViewDataSource {
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        
        return 400
    }
    
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        
        return 1
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        
        let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: "CardCell", for: indexPath) as? CardCell
        cardCell?.setRandomBackgroundColor()
        
        return cardCell!
    }
}

extension ViewController: UICollectionViewDelegateFlowLayout {
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        
        // 20 margin aan beide kanten
        let width = UIScreen.main.bounds.width - 40
    
        let height = collectionView.frame.height - 100
        
        cellSize = CGSize(width: width, height: height)
        
        return cellSize!
    }
}

extension ViewController {
    
    fileprivate func setupCollectionView(){
        
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.bounces = true
        // moet nog mee getweaked worden.....
        collectionView.isPagingEnabled = false
        let flowLayout =  ShazamDiscoverFlowLayout()
        // transform animatie die ervoor zorgt dat eerste cell scaled
        flowLayout.firstItemTransform = 0.05
        // afstand tussen cellen
        flowLayout.minimumLineSpacing = 30
        collectionView.collectionViewLayout = flowLayout
    }
    
    fileprivate func setupScrollView(){
        
        // inset bovenaan instellen
        collectionView.contentInset = UIEdgeInsets(top: 30, left: 0, bottom: 0, right: 0)
    }
}
<commit_msg>Some cell size and spacing tweaks<commit_after>//
//  ViewController.swift
//  ShazamDiscover
//
//  Created by <NAME> on 11/07/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    fileprivate var cellSize: CGSize?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupCollectionView()
        setupScrollView()
    }
}

extension ViewController: UICollectionViewDelegate, UICollectionViewDataSource {
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        
        return 400
    }
    
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        
        return 1
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        
        let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: "CardCell", for: indexPath) as? CardCell
        cardCell?.setRandomBackgroundColor()
        
        return cardCell!
    }
}

extension ViewController: UICollectionViewDelegateFlowLayout {
    
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        
        // 20 margin aan beide kanten
        let width = UIScreen.main.bounds.width - 40
    
        // 90 = 30 top spacing + 90 bottom spacing
        let height = collectionView.frame.height - 120
        
        cellSize = CGSize(width: width, height: height)
        
        return cellSize!
    }
}

extension ViewController {
    
    fileprivate func setupCollectionView(){
        
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.bounces = true
        // moet nog mee getweaked worden.....
        collectionView.isPagingEnabled = false
        let flowLayout =  ShazamDiscoverFlowLayout()
        // transform animatie die ervoor zorgt dat eerste cell scaled
        flowLayout.firstItemTransform = 0.05
        // afstand tussen cellen
        flowLayout.minimumLineSpacing = 40
        collectionView.collectionViewLayout = flowLayout
    }
    
    fileprivate func setupScrollView(){
        
        // inset instellen (spacing top en bottom)
        collectionView.contentInset = UIEdgeInsets(top: 30, left: 0, bottom: 90, right: 0)
    }
}

{'fraction_non_alphanumeric': 0.07187563093074904, 'fraction_numerical': 0.013930950938824955, 'mean_word_length': 2.501060070671378, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5386994', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1341, 'n_words': 341}