<commit_before>//
//  SeriesViewController.swift
//  Recast
//
//  Created by <NAME> on 9/15/18.
//  Copyright © 2018 Cornell AppDev. All rights reserved.
//

import UIKit
import SnapKit

class SeriesViewController: UIViewController {
    
    // MARK: - Variables
    var headerView: SeriesHeaderView!
    var episodeTableView: UITableView!
    
    // MARK: - Constants
    let reuseIdentifer = "episodeCell"
    let headerHeight:CGFloat = 200
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        
        headerView = SeriesHeaderView(frame: .zero)
        
        episodeTableView = UITableView()
        episodeTableView.delegate = self
        episodeTableView.dataSource = self
        episodeTableView.rowHeight = UITableViewAutomaticDimension
        episodeTableView.tableHeaderView = headerView
        
        view.addSubview(episodeTableView)
        
        layoutSubviews()
    }
    
    func layoutSubviews() {
        headerView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
            make.width.equalTo(view.safeAreaLayoutGuide)
        }
        episodeTableView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        episodeTableView.tableHeaderView?.layoutIfNeeded()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

// MARK: - episodeTableView DataSource
extension SeriesViewController: UITableViewDataSource {
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return EpisodeTableViewCell(style: .default, reuseIdentifier: reuseIdentifer)
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let player = PlayerViewController()
        self.present(player, animated: true, completion: nil)
    }
    
}

// MARK: - episodeTableView Delegate
extension SeriesViewController: UITableViewDelegate {
    
}
<commit_msg>moved didSelectRowAt to delegate extension<commit_after>//
//  SeriesViewController.swift
//  Recast
//
//  Created by <NAME> on 9/15/18.
//  Copyright © 2018 Cornell AppDev. All rights reserved.
//

import UIKit
import SnapKit

class SeriesViewController: UIViewController {
    
    // MARK: - Variables
    var headerView: SeriesHeaderView!
    var episodeTableView: UITableView!
    
    // MARK: - Constants
    let reuseIdentifer = "episodeCell"
    let headerHeight:CGFloat = 200
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        
        headerView = SeriesHeaderView(frame: .zero)
        
        episodeTableView = UITableView()
        episodeTableView.delegate = self
        episodeTableView.dataSource = self
        episodeTableView.rowHeight = UITableViewAutomaticDimension
        episodeTableView.tableHeaderView = headerView
        
        view.addSubview(episodeTableView)
        
        layoutSubviews()
    }
    
    func layoutSubviews() {
        headerView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
            make.width.equalTo(view.safeAreaLayoutGuide)
        }
        episodeTableView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        episodeTableView.tableHeaderView?.layoutIfNeeded()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

// MARK: - episodeTableView DataSource
extension SeriesViewController: UITableViewDataSource {
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return EpisodeTableViewCell(style: .default, reuseIdentifier: reuseIdentifer)
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
}

// MARK: - episodeTableView Delegate
extension SeriesViewController: UITableViewDelegate {
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let player = PlayerViewController()
        self.present(player, animated: true, completion: nil)
    }
}

{'fraction_non_alphanumeric': 0.076130389064143, 'fraction_numerical': 0.005888538380651945, 'mean_word_length': 2.638867635807192, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '225400', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1274, 'n_words': 292}