Search code examples
iosstringswiftcalendarmultiline

Inserting carriage returns when sending text to the iOS Calendar


I'm sending text to the iOS calendar using the following code.

event.title = " \(jobTitle) \r\n" + "\(jobDescription)"

This does not work. I don't get a carriage return. Does anybody know of a work around to get my job titles and job descriptions to display on a multiline when sending to event.title?


Solution

  • event.title = "\(jobTitle)\n\(jobDescription)"
    

    should works.

    Note: not every view in iOS Calendar application correctly display multi-line title event.

    For example:

    ev.title = "TestJobTitle\nTest job description"
    

    List view:
    screenshot3
    Detail view:
    screenshot1
    Grid view:
    screenshot2