```
import UIKit
class MyView: UIViewController {
    @IBOutlet var mySwitch: UISwitch!
    @IBOutlet var myDatePicker: UIDatePicker!
    func datePicker() { myDatePicker.datePickerMode = UIDatePickerMode.Date }
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        datePicker()
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    @IBAction func switchPressed(sender: AnyObject) {
        if mySwitch.on{
            var localNotification:UILocalNotification = UILocalNotification()
            localNotification.alertAction = "Open App"
            localNotification.alertBody = "Here is your notification at 7:00 AM"
            localNotification.fireDate = myDatePicker.date
            localNotification.repeatInterval = NSCalendarUnit.CalendarUnitDay
            UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
        } else {
            var localNotification:UILocalNotification = UILocalNotification()
            localNotification.alertAction = "Open App"
            localNotification.alertBody = "This notification should not appear"
            localNotification.fireDate = NSDate(timeIntervalSinceNow: 999999999999)
            IApplication.sharedApplication().scheduleLocalNotification(localNotification)
        }
    }
}

```