Contents

thoven87/icalendar-kit

A comprehensive Swift 6 library for parsing and creating iCalendar (RFC 5545) events with full support for structured concurrency, Sendable conformance, and modern Swift features.

Features

  • RFC Compliant: Full support for RFC 5545, 7986, 6868, 7808, and more
  • Swift 6 Ready: Complete Sendable conformance and structured concurrency support
  • Modern API: Fluent EventBuilder with transparency, versioning, location, and theming support
  • Maximum Compatibility: Automatic legacy X-WR fallbacks for older calendar systems
  • Comprehensive: Events, todos, journals, alarms, time zones, recurrence rules, and VCards
  • Type Safe: Unified alarm API with RFC-compliant action-specific requirements

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/thoven87/icalendar-kit.git", from: "2.0.0")
]

Quick Start

Creating Events

import ICalendar

let event = EventBuilder(summary: "Team Meeting")
    .starts(at: Date(), timeZone: .current)
    .duration(3600)
    .location("Conference Room A")
    .description("Weekly team sync")
    
    // Modern properties
    .transparent()  // Shows as available time
    .sequence(1)    // Event version
    .geoCoordinates(latitude: 37.7749, longitude: -122.4194)
    .color(hex: "FF5733")
    .conference("https://zoom.us/j/123456789")
    .attachment("agenda.pdf", mediaType: "application/pdf")
    
    // Attendees and alarms
    .organizer(email: "manager@company.com", name: "Manager")
    .addAlarm(.display(description: "Meeting in 15 min"), trigger: .minutesBefore(15))
    .buildEvent()

var calendar = ICalendar(productId: "-//My App//EN")
calendar.addEvent(event)

let icsString = try ICalendarSerializer().serialize(calendar)

Parsing Calendars

let icalContent = """
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//My App//EN
BEGIN:VEVENT
UID:event-123
SUMMARY:Important Meeting
DTSTART:20240101T140000Z
DTEND:20240101T150000Z
END:VEVENT
END:VCALENDAR
"""

let calendar = try ICalendarKit.parseCalendar(from: icalContent)
print("Found \(calendar.events.count) events")

Working with VCards

let contact = VCardBuilder(name: "John Doe")
    .email("john@company.com")
    .phone("+1-555-0123")
    .organization("Tech Corp")
    .buildVCard()

let vcfString = try VCardSerializer().serialize([contact])

EventBuilder Properties

The modern EventBuilder API supports all essential iCalendar properties:

| Category | Properties | |----------|------------| | Scheduling | starts(), ends(), duration(), allDay() | | Status | confirmed(), tentative(), cancelled() | | Priority | priority(), highPriority(), lowPriority() | | Classification | publicEvent(), privateEvent(), confidential() | | Availability | transparent(), opaque(), transparency() | | Versioning | sequence() | | Location | location(), geoCoordinates() | | Visual | color(), color(hex:), image() | | Modern | conference(), attachment() | | RFC 9073 | venue(), locationComponent(), resource() | | People | organizer(), addAttendee() | | Recurrence | repeats*() methods | | Alarms | addAlarm(), reminderBefore() |

Documentation

For comprehensive documentation, examples, and advanced usage:

πŸ“– Complete Documentation

Includes:

  • Advanced EventBuilder usage
  • Recurring events and time zones
  • RFC compliance details
  • Server integration examples
  • VCard contact management
  • Migration guides

Requirements

  • iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+
  • Swift 6.0+
  • Xcode 16.0+
  • Linux

RFC Compliance

| RFC | Description | Status | |-----|-------------|---------| | RFC 5545 | iCalendar Core | βœ… Complete | | RFC 7986 | Calendar Extensions | βœ… Complete | | RFC 6868 | Parameter Encoding | βœ… Complete | | RFC 7808 | Time Zone Data | βœ… Complete | | RFC 9073 | Event Publishing Extensions | βœ… Complete |

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Package Metadata

Repository: thoven87/icalendar-kit

Default branch: main

README: README.md