 
 import UIKit
 import MediaPlayer
-var alarms: [Alarm] = [Alarm]()
 
 class MainAlarmViewController: UITableViewController{
     
-    
-    
-    /*let alarm = Alarm(title: "test", timestr: "", time: NSDate())
-    
-    @IBAction func AddAlarm(sender: AnyObject) {
-        var timePicker = UIPickerView()
-        //timePicker.dataSource = self
-        //timePicker.delegate = self
-        alarms.append(alarm)
-        tableView.reloadData();
-        
-    }*/
-    
+    var alarmDelegate: AlarmApplicationDelegate = AppDelegate()
 
     override func viewDidLoad() {
         super.viewDidLoad()


    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // Return the number of rows in the section.
        return alarms.count
    }
    
    /*
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
            let rowValue = alarms[indexPath.row].timeStr


    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = tableView.dequeueReusableCellWithIdentifier("AlarmCell", forIndexPath: indexPath) as! UITableViewCell
        
            //cell = UITableViewCell(style: .Subtitle, reuseIdentifier: "AlarmCell")
            cell.tag = indexPath.row
            let ala = Alarms.sharedInstance[indexPath.row] as Alarm
            cell.textLabel?.text = ala.timeStr
            cell.detailTextLabel?.text = ala.title
        
        

        // Configure the cell...
        
        let sw = UISwitch(frame: CGRect())
        //tag is used to indicate which row had been touched
        
        sw.tag = indexPath.row

        //cell.detailTextLabel?.text = ala.time
        cell.backgroundColor = UIColor(red: 0.8, green: 0.8, blue: 0.8, alpha: 1.0)
        sw.addTarget(self, action: "SwitchTapped:", forControlEvents: UIControlEvents.TouchUpInside)
