<commit_before>//
//  ForecastViewController.swift
//  WeatherTest
//
//  Created by <NAME> on 14/02/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

class ForecastViewController: UIViewController, UITableViewDataSource , UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var forecastList = [Forecast]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        tableView.registerNib(UINib(nibName: "WeatherCell", bundle: NSBundle.mainBundle()), forCellReuseIdentifier: "weatherCell")
        tableView.allowsSelection = false

    }
    
    override func viewWillAppear(animated: Bool) {        
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadData", name: RELOAD_NOTIFICATION, object: nil)
        self.navigationController?.topViewController.title = DI.context.locations.selectedLocation.city
        reloadData()
        super.viewWillAppear(animated)
    }
    
    override func viewWillDisappear(animated: Bool) {
        NSNotificationCenter.defaultCenter().removeObserver(self)
        super.viewDidDisappear(animated)
    }

    func reloadData() {
        forecastList = DI.context.locations.selectedLocation.weather.forecastList
        tableView.reloadData()
    }
    
    @IBAction func onSwipeRight(sender: AnyObject) {
        if let tbc = tabBarController as? TabBarController {
            tbc.prevTab()
        }
    }
    @IBAction func onSwipeLeft(sender: AnyObject) {
        if let tbc = tabBarController as? TabBarController {
            tbc.nextTab()
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    //MARK: - UITableViewDataSource
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCellWithIdentifier("weatherCell") as WeatherCell!
        return cell
    }
    
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return forecastList.count
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 90
    }
    
    func tableView(tableView: UITableView, willDisplayCell cell: WeatherCell, forRowAtIndexPath indexPath: NSIndexPath) {
       var day = forecastList[indexPath.item]
        
        cell.titleLabel.text = day.weekday
        cell.tempreatureLabel.text = day.tempreature(true)
        cell.icon.image = day.iconImage
        cell.weatherLabel.text = DI.context.locations.selectedLocation.weather.type
     
        DI.context.animateTableCell(cell)
        
        
    }

}
<commit_msg>navigation item title fix while for change tab<commit_after>//
//  ForecastViewController.swift
//  WeatherTest
//
//  Created by <NAME> on 14/02/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

class ForecastViewController: UIViewController, UITableViewDataSource , UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var forecastList = [Forecast]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        tableView.registerNib(UINib(nibName: "WeatherCell", bundle: NSBundle.mainBundle()), forCellReuseIdentifier: "weatherCell")
        tableView.allowsSelection = false

    }
    
    override func viewWillAppear(animated: Bool) {        
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadData", name: RELOAD_NOTIFICATION, object: nil)
        self.navigationController?.topViewController.title = DI.context.locations.selectedLocation.city
        self.navigationController?.navigationBar.topItem?.title = DI.context.locations.selectedLocation.city
        reloadData()
        super.viewWillAppear(animated)
    }
    
    override func viewWillDisappear(animated: Bool) {
        NSNotificationCenter.defaultCenter().removeObserver(self)
        super.viewDidDisappear(animated)
    }

    func reloadData() {
        forecastList = DI.context.locations.selectedLocation.weather.forecastList
        tableView.reloadData()
    }
    
    @IBAction func onSwipeRight(sender: AnyObject) {
        if let tbc = tabBarController as? TabBarController {
            tbc.prevTab()
        }
    }
    @IBAction func onSwipeLeft(sender: AnyObject) {
        if let tbc = tabBarController as? TabBarController {
            tbc.nextTab()
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    //MARK: - UITableViewDataSource
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCellWithIdentifier("weatherCell") as WeatherCell!
        return cell
    }
    
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return forecastList.count
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 90
    }
    
    func tableView(tableView: UITableView, willDisplayCell cell: WeatherCell, forRowAtIndexPath indexPath: NSIndexPath) {
       var day = forecastList[indexPath.item]
        
        cell.titleLabel.text = day.weekday
        cell.tempreatureLabel.text = day.tempreature(true)
        cell.icon.image = day.iconImage
        cell.weatherLabel.text = DI.context.locations.selectedLocation.weather.type
     
        DI.context.animateTableCell(cell)
        
        
    }

}

{'fraction_non_alphanumeric': 0.08620689655172414, 'fraction_numerical': 0.0041797283176593526, 'mean_word_length': 2.8159468438538204, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '1460824', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1590, 'n_words': 323}