<commit_before>//
//  ScheduleViewController.swift
//  TrolleyTracker
//
//  Created by <NAME> on 10/11/15.
//  Copyright © 2015 Code For Greenville. All rights reserved.
//

import UIKit

private extension ScheduleController.DisplayType {

    func displayString() -> String {
        switch self {
        case .route:
            return LS.scheduleTypeRoute
        case .day:
            return LS.scheduleTypeDay
        }
    }
}

protocol ScheduleVCDelegate: class {
    func didSelectScheduleTypeIndex(_ index: Int)
    func viewDidAppear()
}

class ScheduleViewController: UIViewController, UINavigationBarDelegate {

    weak var delegate: ScheduleVCDelegate?
    
    let tableView: UITableView = {
        let tv = UITableView(frame: .zero, style: .plain).useAutolayout()
        tv.estimatedRowHeight = 60
        tv.rowHeight = UITableViewAutomaticDimension
        tv.registerView(ofType: ScheduleHeaderView.self)
        tv.registerCell(ofType: ScheduleViewCell.self)
        return tv
    }()

    lazy var displayTypeControl: UISegmentedControl = {
        let sc = UISegmentedControl().useAutolayout()
        sc.tintColor = UIColor.ttLightGray()
        for displayType in ScheduleController.DisplayType.all {
            let index = displayType.rawValue
            let title = displayType.displayString()
            sc.insertSegment(withTitle: title, at: index, animated: false)
        }
        sc.addTarget(self,
                     action: #selector(segmentedControlValueChanged(_:)),
                     for: .valueChanged)<commit_msg>Fix a bug where the schedule type control was hidden<commit_after>//
//  ScheduleViewController.swift
//  TrolleyTracker
//
//  Created by <NAME> on 10/11/15.
//  Copyright © 2015 Code For Greenville. All rights reserved.
//

import UIKit

private extension ScheduleController.DisplayType {

    func displayString() -> String {
        switch self {
        case .route:
            return LS.scheduleTypeRoute
        case .day:
            return LS.scheduleTypeDay
        }
    }
}

protocol ScheduleVCDelegate: class {
    func didSelectScheduleTypeIndex(_ index: Int)
    func viewDidAppear()
}

class ScheduleViewController: UIViewController, UINavigationBarDelegate {

    weak var delegate: ScheduleVCDelegate?
    
    let tableView: UITableView = {
        let tv = UITableView(frame: .zero, style: .plain).useAutolayout()
        tv.estimatedRowHeight = 60
        tv.rowHeight = UITableViewAutomaticDimension
        tv.registerView(ofType: ScheduleHeaderView.self)
        tv.registerCell(ofType: ScheduleViewCell.self)
        return tv
    }()

    lazy var displayTypeControl: UISegmentedControl = {
        let sc = UISegmentedControl()
        sc.tintColor = UIColor.ttLightGray()
        for displayType in ScheduleController.DisplayType.all {
            let index = displayType.rawValue
            let title = displayType.displayString()
            sc.insertSegment(withTitle: title, at: index, animated: false)
        }
        sc.sizeToFit()
        sc.addTarget(self,
                     action: #selector(segmentedControlValueChanged(_:)),
                     for: .valueChanged)
{'fraction_non_alphanumeric': 0.08375314861460957, 'fraction_numerical': 0.007556675062972292, 'mean_word_length': 2.495049504950495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3749892', 'n_tokens_mistral': 908, 'n_tokens_neox': 851, 'n_words': 211}