Swiftpack.co - swift-calendar/icalendarkit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by swift-calendar.
swift-calendar/icalendarkit 1.0.2
Lightweight iCalendar (RFC 5545) encoder for Swift
⭐️ 22
🕓 2 years ago
.package(url: "https://github.com/swift-calendar/icalendarkit.git", from: "1.0.2")

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

GitHub

link
Stars: 22
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Release Notes

Support Calendar extensions
2 years ago

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

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics