title: How to sum days to a NSDate
body: <p>How I could sum days to a DATE of type NSDate in order to create multiple events from this DATE?</p>
  
  <p>This is my code that control the iOS calendar:</p>
  
  <pre><code>import UIKit  import EventKit    class ViewController: UIViewController {
  
  
      }
      @IBOutlet weak var needPermissionView: UIView!
  
      let eventStore = EKEventStore()
  
      override func viewDidLoad() {
          super.viewDidLoad()
          checkCalendarAuthorizationStatus()
          // 1
          //let eventStore : EKEventStore = EKEventStore()
  
          /*
          // 2
          switch EKEventStore.authorizationStatusForEntityType(EKEntityType.Event) {
          case .Authorized:
              print("Authorized")
         //     insertEvent(eventStore)
          case .Denied:
              print("Access denied")
          case .NotDetermined:
              break
          // 3
          default:
              print("Case Default")
          } //        insertEvent(eventStore)   */
      }
  
  
  
  
      func checkCalendarAuthorizationStatus() {
          let status = EKEventStore.authorizationStatusForEntityType(EKEntityType.Event)
  
          switch (status) {
          case EKAuthorizationStatus.NotDetermined:
              // This happens on first-run
              requestAccessToCalendar()
          case EKAuthorizationStatus.Authorized:
              // Things are in line with being able to show the calendars in the table view
              loadCalendars()
             // refreshTableView()
          case EKAuthorizationStatus.Restricted, EKAuthorizationStatus.Denied:
              // We need to help them give us permission
              needPermissionView.fadeIn()
          }
      }
  
      func requestAccessToCalendar() {
  
          eventStore.requestAccessToEntityType(EKEntityType.Event, completion: {
              (accessGranted: Bool, error: NSError?) in
  
              if accessGranted == true {
                  dispatch_async(dispatch_get_main_queue(), {
                      self.loadCalendars()  //                   self.loadCalendars()  //                   self.refreshTableView()
                  })
              } else {
                  dispatch_async(dispatch_get_main_queue(), {
                      self.needPermissionView.fadeIn()
                  })
              }
          })
      }
  
  
  
      func insertEvent(store: EKEventStore) {
          // 1
          let calendars = store.calendarsForEntityType(EKEntityType.Event)
  
  
          for calendar in calendars {
              // 2
              if calendar.title == "ioscreator" {
                  // 3
                  let startDate = NSDate()
                  // 2 hours
                  let endDate = startDate.dateByAddingTimeInterval(2 * 60 * 60)
  
                  // 4
                  // Create Event
                  let event = EKEvent(eventStore: store)
                  event.calendar = calendar
  
                  event.title = "New Meeting"
                  event.startDate = startDate
                  event.endDate = endDate
  
                  // 5
                  // Save Event in Calendar
                  var error: NSError?
                  let result: Bool
                  do {
  
                      try store.saveEvent(event, span: .ThisEvent)
                      result = true
                  } catch let error1 as NSError {
                      error = error1
                      result = false
                  }
  
                  if result == false {
                      if let theError = error {
                          print("An error occured \(theError)")
                      }
                  }
              }
          }
      }
  
      func loadCalendars() {
          insertEvent(eventStore)   //      self.calendars = eventStore.calendarsForEntityType(EKEntityType.Event)
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
        }
  </code></pre>