When I run this, the first time I open History tab, nothing shows up on the tableView. Only after I rotate the screen things show up but they are still being funny.Both labels show up only after rotating the screen. Not all the history is being shown as well sometimes. I read that I am missing some initializer but I keep getting errors once change things... Any help will be appreciated
//
    //  SecondViewController.swift
    //
    //  Created by Artiom Sobol on 1/3/16.
    //  Copyright © 2016 Artiom Sobol. All rights reserved.
    //
    import UIKit
    class History: UIViewController, UITableViewDataSource, UITableViewDelegate
    {
        // test variable
        var test: MyHistory!
        // array to store unarchived history
        var newHistory = [MyHistory]()
        //outlet for tableview
        @IBOutlet var tableView: UITableView!
        override func viewDidLoad()
        {
            //change the background
            self.view.backgroundColor = UIColor(patternImage: UIImage(named: "newBackground.jpg")!)
            super.viewDidLoad()
            tableView.delegate = self
            tableView.dataSource = self
            //self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "historyCell")
            self.tableView.reloadData()
            //unarchive any new data
            let defaults = NSUserDefaults.standardUserDefaults()
            if let savedPeople = defaults.objectForKey("MyHistory") as? NSData {
                newHistory = NSKeyedUnarchiver.unarchiveObjectWithData(savedPeople) as! [MyHistory]
            }
        }
        func tableView(tableView: UITableView,numberOfRowsInSection section: Int) -> Int
        {
            if (newHistory.count < 1)
            {
                return 1
            }
            else
            {
                return self.newHistory.count
            }
        }
        func numberOfSectionsInTableView(tableView: UITableView) -> Int
        {
            return 1
        }
        func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
        {
            let cell = tableView.dequeueReusableCellWithIdentifier("historyCell", forIndexPath: indexPath) as! historyCell
            let person = newHistory[indexPath.item]
            let defaults2 = NSUserDefaults.standardUserDefaults()
            print("This is count", newHistory.count)
            if let savedPeople = defaults2.objectForKey("MyHistory") as? NSData {
                newHistory = NSKeyedUnarchiver.unarchiveObjectWithData(savedPeople) as! [MyHistory]
            }
           // cell.durationLabel.text = String(person.durationNumber)
            let (hour,minutes,seconds) = secondsToHoursMinutesSeconds(person.durationNumber)
            if(seconds < 10 && minutes < 10)
            {
                cell.durationLabel.text = "0\(hour):0\(minutes):0\(seconds)"
            }
            else if(seconds > 9 && minutes < 10)
            {
                cell.durationLabel.text = "0\(hour):0\(minutes):\(seconds)"
            }
            else if(seconds > 9 && minutes > 9)
            {
                cell.durationLabel.text = "0\(hour):\(minutes):\(seconds)"
            }
            else if(seconds < 10 && minutes > 9)
            {
                cell.durationLabel.text = "0\(hour):\(minutes):0\(seconds)"
            }
            cell.kicksLabel.text = String(person.kicksNumber)
            return cell
        }
        func secondsToHoursMinutesSeconds (seconds : Int) -> (Int, Int, Int)
        {
            return (seconds / 3600, (seconds % 3600) / 60, (seconds % 3600) % 60)
        }
        override func viewWillAppear(animated: Bool)
        {
            super.viewWillAppear(animated)
            self.tableView.reloadData()
        }
    }
 
     
     
     
    