Populating Events in to Tableview (Swift)
<p>I am trying to populate my daily events in to tableview. I have made the connections. (datasource, delegate and tableview) But events value is returning 0. 
Sorry if this has been asked else where. I need a little help.</p>

<p>Here is my code.</p>

<p>import UIKit
import EventKit
import EventKitUI</p>

<p>class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {</p>

<pre><code>var eventStore: EKEventStore?
var events = [EKEvent]()
var startDate = NSDate()
var endDate = NSDate()
var cellIdentifier = "cell"


@IBOutlet var tableView: UITableView!



override func viewDidLoad() {
    super.viewDidLoad()
    automaticallyAdjustsScrollViewInsets = false


    self.tableView.dataSource = self
    self.tableView.delegate = self

    self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier);
    //self.tableView.reloadData()
    self.eventStore = EKEventStore()

    fetchEvents { (arr:[EKEvent]) in
        print(arr)
        self.events = arr
        //reload table
    }
   self.tableView.reloadData()
}

func fetchEvents(completed: ([EKEvent]) -&gt; ()) {
    eventStore!.requestAccessToEntityType(EKEntityType.Event, completion: {
        granted, error in
        let startDt = NSDate(timeIntervalSinceNow: -24 * 60 * 60);
        let predicate = self.eventStore!.predicateForEventsWithStartDate(startDt, endDate: NSDate(), calendars: nil)
        let events = self.eventStore!.eventsMatchingPredicate(predicate)
        completed(events)
    })
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

}

@IBAction func onLoadListButtonClicked(sender: AnyObject)
{
    self.performSegueWithIdentifier("LoadTheList", sender: nil)
}



func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
    return 1
}


//MARK: UITableViewDataSource
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
    //TEST PRINT EVENT COUNT
    print("event count (print) \(events.count)")

    return events.count
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {

    let cellIdentifier = "cell"
    let cell:UITableViewCell! = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath)
    let events:EKEvent! = self.events[indexPath.row]
    cell.textLabel!.text = events.title
    cell.detailTextLabel!.text = events.startDate.description
    print("event cell returned")
    return cell
}
</code></pre>

<p>}</p>