<commit_before>//
//  ViewController.swift
//  IceFishingTrending
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

class MainViewController: UIViewController, SearchTrackResultsViewControllerDelegate {

    let options: UISegmentedControl = UISegmentedControl(items: ["Songs", "Users"])
    
    var childVC2 = TrendingViewController()
    var childVC1 = FeedViewController(nibName: "FeedViewController", bundle: nil)
    //var childVC1 = FeedViewController()
    var searchController: UISearchController!
    var searchNavigationController: UINavigationController!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        println(self.navigationController?.navigationBar.frame.height)
        // Add Songs/Users option element to the navbar
        options.selectedSegmentIndex = 0
        options.tintColor = UIColor.grayColor()
        options.addTarget(self, action: "switchTable", forControlEvents: .ValueChanged)
//        navigationItem.titleView = options
        
        
        navigationItem.title = "Songs"
        
        // Add plus sign to the right side of the navbar
        let button = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "initializePostCreation")
        navigationItem.rightBarButtonItem = button
        
        addChildViewController(childVC1)
        childVC1.view.frame = view.bounds
        view.addSubview(childVC1.view)
        
        navigationController?.navigationBar.barTintColor = UIColor(red: 181.0 / 255.0, green: 87.0 / 255.0, blue: 78.0 / 255.0, alpha: 1.0)
        navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        navigationController?.navigationBar.barStyle = .Black
//        navigationController?.navigationBar.translucent = true
        
        // Add profile button to the left side of the navbar
        var profileButton = UIButton(frame: CGRect(x: 0, y: 0, width: 45, height: navigationController!.navigationBar.frame.height))
        profileButton.setImage(UIImage(named: "Profile-Icon"), forState: .Normal)
        profileButton.addTarget(self, action: "pushToProfile", forControlEvents: .TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profileButton)
        
        // Arbitrary additions for SWRevealVC
        revealViewController().panGestureRecognizer()
        revealViewController().tapGestureRecognizer()
        
    }
    
    // Add profile button
    func pushToProfile() {
        let loginViewController = LoginViewController(nibName: "LoginViewController", bundle: nil)
        var feedButton = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: navigationController!.navigationBar.frame.height))
        feedButton.setImage(UIImage(named: "Feed-Icon"), forState: .Normal)
        feedButton.addTarget(self, action: "closeProfileView", forControlEvents: .TouchUpInside)
        loginViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: feedButton)

        searchNavigationController = UINavigationController(rootViewController: loginViewController)
        presentViewController(searchNavigationController, animated: false, completion: nil)
    }
    
    func switchTable() {
        if (options.selectedSegmentIndex == 1 && childViewControllers[0] as! NSObject == childVC1) {
            childVC1.view.removeFromSuperview() //Removes it from view
            childVC1.removeFromParentViewController() //Removes it as child
            childVC2.view.frame = view.bounds
            addChildViewController(childVC2) //Adds as child
            view.addSubview(childVC2.view) //Adds to view
        } else if (options.selectedSegmentIndex == 0 && childViewControllers[0] as! NSObject == childVC2) {
            childVC2.view.removeFromSuperview()
            childVC2.removeFromParentViewController()
            addChildViewController(childVC1)
            childVC1.view.frame = view.bounds
            view.addSubview(childVC1.view)
        }
    }
    
    func initializePostCreation() {
        var searchResultsViewController = SearchTrackResultsViewController() as SearchTrackResultsViewController
        <commit_msg>Removed Trending from MainViewController<commit_after>//
//  ViewController.swift
//  IceFishingTrending
//
//  Created by <NAME> on 3/8/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

class MainViewController: UIViewController, SearchTrackResultsViewControllerDelegate {

    let options: UISegmentedControl = UISegmentedControl(items: ["Songs", "Users"])
    
    var childVC1 = FeedViewController(nibName: "FeedViewController", bundle: nil)
    //var childVC2 = TrendingViewController()
    var searchController: UISearchController!
    var searchNavigationController: UINavigationController!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        println(self.navigationController?.navigationBar.frame.height)
        // Add Songs/Users option element to the navbar
        options.selectedSegmentIndex = 0
        options.tintColor = UIColor.grayColor()
        options.addTarget(self, action: "switchTable", forControlEvents: .ValueChanged)
//        navigationItem.titleView = options
        
        
        navigationItem.title = "Songs"
        
        // Add plus sign to the right side of the navbar
        let button = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "initializePostCreation")
        navigationItem.rightBarButtonItem = button
        
        addChildViewController(childVC1)
        childVC1.view.frame = view.bounds
        view.addSubview(childVC1.view)
        
        navigationController?.navigationBar.barTintColor = UIColor(red: 181.0 / 255.0, green: 87.0 / 255.0, blue: 78.0 / 255.0, alpha: 1.0)
        navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        navigationController?.navigationBar.barStyle = .Black
//        navigationController?.navigationBar.translucent = true
        
        // Add profile button to the left side of the navbar
        var profileButton = UIButton(frame: CGRect(x: 0, y: 0, width: 45, height: navigationController!.navigationBar.frame.height))
        profileButton.setImage(UIImage(named: "Profile-Icon"), forState: .Normal)
        profileButton.addTarget(self, action: "pushToProfile", forControlEvents: .TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profileButton)
        
        // Arbitrary additions for SWRevealVC
        revealViewController().panGestureRecognizer()
        revealViewController().tapGestureRecognizer()
        
    }
    
    // Add profile button
    func pushToProfile() {
        let loginViewController = LoginViewController(nibName: "LoginViewController", bundle: nil)
        var feedButton = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: navigationController!.navigationBar.frame.height))
        feedButton.setImage(UIImage(named: "Feed-Icon"), forState: .Normal)
        feedButton.addTarget(self, action: "closeProfileView", forControlEvents: .TouchUpInside)
        loginViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: feedButton)

        searchNavigationController = UINavigationController(rootViewController: loginViewController)
        presentViewController(searchNavigationController, animated: false, completion: nil)
    }
    
    func initializePostCreation() {
        var searchResultsViewController = SearchTrackResultsViewController() as SearchTrackResultsViewController
        
{'fraction_non_alphanumeric': 0.08920618286612524, 'fraction_numerical': 0.014278228975635316, 'mean_word_length': 3.2701342281879193, 'pattern_counts': {'":': 0, '<': 7, '<?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': '406480', 'n_tokens_mistral': 2124, 'n_tokens_neox': 1986, 'n_words': 443}