VCalendar

public struct VCalendar

A VCalendar is the core object. When exchanging data with other clients, they are always embedded inside of a VCalendar. A VCalendar can be seen as a container for other Calendaring and Scheduling objects. It contains timezones and events.

Basic usage

By default a creating a new VCalendar does not require any arguments.

var calendar = VCalendar()
calendar.icalString()
BEGIN:VCALENDAR
PRODID:-//SwiftIcal/EN
VERSION:2.0
END:VCALENDAR

Adding Events

Events can be added by appending to the events property.

By default adding a VEvent will also timezone definitions for all timezones used in the icalString() If this behaviour is not wanted, it can be disabled by setting autoincludeTimezones to false

  • Product identifier.

    Application should set this property to a value to represent the product. Most calendaring applications do not display this information to users. For details refer to Section 3.7.3 of RFC 5545

    Declaration

    Swift

    public var prodid: String
  • Object Method for the VCalendar. Only if the Calendar is used for scheduling, a method needs is required. For details, refer to RFC5546 to learn more about the iCalendar Transport-Independent Interoperability Protocol (iTIP) and the methods it uses.

    Declaration

    Swift

    public var method: Method?
  • VCalendar version, currently only 2.0 is supported.

    Declaration

    Swift

    public var version: CalendarVersion
  • Timezones in the VCalendar.

    Declaration

    Swift

    public var timezones: [TimeZone]
  • VEvents in the Calendar.

    Declaration

    Swift

    public var events: [VEvent]
  • If autoincludeTimezones is enabled, timezone definitions for all timezones used in vevents will be added to the VCALENDAR output.

    Declaration

    Swift

    public var autoincludeTimezones: Bool
  • Creates a new VCALENDAR

    Declaration

    Swift

    public init()
  • Returns the VCALENDAR representation as a string

    Declaration

    Swift

    public func icalString() -> String