Skip to content

feat: format calendars - #38

Open
redryerye wants to merge 1 commit into
mainfrom
feat/format-calendars
Open

feat: format calendars#38
redryerye wants to merge 1 commit into
mainfrom
feat/format-calendars

Conversation

@redryerye

Copy link
Copy Markdown
Owner

Summary

  • Add public ICFormatter.format(_:) support for serializing calendars to .ics text
  • Serialize core calendar fields and supported VEVENT fields
  • Reuse TEXT escaping and line folding so generated output is parser-compatible
  • Mark calendar formatting complete in the README roadmap

Example ICS

Given an ICalendar with an event, formatting can produce output like:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Inc//Calendar//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:format-test
DTSTAMP:20240728T120000Z
DTSTART;VALUE=DATE:20240729
SUMMARY:Board\, product\; roadmap
DESCRIPTION:Line 1\nLine 2
END:VEVENT
END:VCALENDAR

What becomes available

let ics = ICFormatter.format(calendar)
let parsed = ICParser().calendar(from: ics)

The formatter currently covers supported calendar fields and supported VEVENT fields, including TEXT escaping, DATE/DATE-TIME values, URI values, text lists, and folded content lines.

Validation

  • swift test
  • swiftlint lint --quiet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant