icalendarkit

1.0.2

Lightweight iCalendar (RFC 5545) encoder for Swift
swift-calendar/icalendarkit

What's New

Support Calendar extensions

2021-11-09T04:52:48Z

vCalendar and iCalendar support private software extensions, with a X- prefix, a number of which are in common usage these days. This release bring in the next X- prefix variables into iCalendarkit.

  • X-MICROSOFT-CDO-ALLDAYEVENT in ICalendarEvent
  • X-MICROSOFT-CDO-BUSYSTATUS in ICalendarEvent
  • X-MICROSOFT-CDO-INTENDEDSTATUS in ICalendarEvent
  • X-MICROSOFT-CDO-IMPORTANCE in ICalendarEvent
  • X-WR-CALNAME in ICalendar
  • X-WR-CALDESC in ICalendar
  • X-WR-RELCALID in ICalendar
  • X-PUBLISHED-TTL in ICalendar

iCalendarKit for Swift

Linux macOS Docs

A lightweight iCalendar (RFC 5545, .ics) encoder for Swift.

Example

import Foundation
import ICalendarKit

var cal = ICalendar()

cal.events.append(ICalendarEvent(
    description: "My awesome event",
    dtstart: .dateTime(Date()),
    duration: .hours(1),
    rrule: .init(
        frequency: .weekly,
        byDay: [.every(.tuesday), .every(.saturday)]
    )
))

print(cal.vEncoded)

// The output looks similar to this:
//
// BEGIN:VCALENDAR
// VERSION:2.0
// PRODID:-//swift-icalendar//swift-icalendar//EN
// CALSCALE:GREGORIAN
// BEGIN:VEVENT
// DTSTAMP:20201017T000135Z
// UID:327278D1-F140-49C9-AB75-C1D9579C1851
// CREATED:20201017T000135Z
// DESCRIPTION:My awesome event
// DTSTART:20201017T000135Z
// LAST-MODIFIED:20201017T000135Z
// DURATION:P0DT1H0M0S
// RRULE:FREQ=WEEKLY;BYDAY=TU,SA
// END:VEVENT
// END:VCALENDAR

Hint: Run swift run --repl to run an interactive Swift shell with access to the library

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Tue Dec 03 2024 00:30:29 GMT-1000 (Hawaii-Aleutian Standard Time)