 import Foundation
 import MediaPlayer
 
-class Alarm
+struct Alarm
 {
     //using memberwise initializer for struct
-    var title: String
+    var label: String
     var timeStr: String
     var date: NSDate
     var enabled: Bool
     var UUID: String
     var mediaID: String
     
-    init(title: String, timeStr: String, date: NSDate, enabled: Bool,UUID: String, mediaID: String)
+    /*init(title: String, timeStr: String, date: NSDate, enabled: Bool,UUID: String, mediaID: String)
     {
         self.title = title
         self.timeStr = timeStr

    private init()
    {
        ud = NSUserDefaults.standardUserDefaults()
        /*for key in ud.dictionaryRepresentation().keys {
            NSUserDefaults.standardUserDefaults().removeObjectForKey(key.description)
        }*/
        alarmKey = "myAlarmKey"
        alarms = getAllAlarm()
    }

        alarms.append(alarm)
        //ud.setObject(alarms!,forKey: alarmKey)
        var alarmDict = ud.dictionaryForKey(alarmKey) ?? [:]
        alarmDict[alarm.UUID] = ["label": alarm.label, "timeStr": alarm.timeStr, "date": alarm.date, "enabled": alarm.enabled, "UUID": alarm.UUID, "mediaID": alarm.mediaID]
        ud.setObject(alarmDict, forKey: alarmKey)
        ud.synchronize()
    }
