0

currently im using this code snippet to add an event to the calendar

let date = NSDate()
let calendar = NSCalendar.current
let hour = calendar.component(.hour, from: date as Date)
let minutes = calendar.component(.minute, from: date as Date)
self.addEventToCalendar(title: "lol", description: "lal", startDate: date, endDate: date)

which is not refined, but it works. I have 2 questions:

is there a way to use the same form for adding an event to the iOS calendar as you see when iOS recognises a date in your e-mails?

is there a way to directly transform a string in to a date? I get the date from the backend like: 31.12.2016 22:30:00 (DD.MM.YYYY HH:MM:SS).

Jochen Österreicher
  • 683
  • 2
  • 11
  • 25

0 Answers0