         {
             println("switch off")
             sender.superview?.backgroundColor = UIColor(red: 0.8, green: 0.8, blue: 0.8, alpha: 1.0)
-            alarms[sender.tag].enabled = false
+            Alarms.sharedInstance[sender.tag].enabled = false
             //UIApplication.sharedApplication().cancelLocalNotification(UIApplication.sharedApplication().scheduledLocalNotifications[sender.tag] as! UILocalNotification)
             UIApplication.sharedApplication().scheduledLocalNotifications = nil
-            for alarm in alarms{
+            for alarm in Alarms.sharedInstance{
                 if alarm.enabled{
-                MainAlarmViewController.setNotificationWithDate(alarm.date)
+                alarmDelegate.setNotificationWithDate(alarm.date)
                 }
             }
             


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();
        
    }*/
    

    override func viewDidLoad() {
        super.viewDidLoad()

    
    
    
    @IBAction func SwitchTapped(sender: UISwitch)
    {
        if sender.on 
        {
            println("switch on")
            sender.superview?.backgroundColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
            Alarms.sharedInstance[sender.tag].enabled = true
            alarmDelegate.setNotificationWithDate(Alarms.sharedInstance[sender.tag].date)
            
            
        }
