iCalSwift - iCalendar(RFC 5545) encoder and decoder for Swift

Overview

iCalSwift

iCalendar(RFC 5545) encoder and decoder for Swift

Encode a VEvent

let alarm = ICalAlarm.audioProp(
            trigger: Date(),
            duration: .init(totalSeconds: 3000),
            repetition: nil,
            attach: nil)

let event = ICalEvent(
            dtstamp: Date(),
            uid: "[email protected]",
            classification: nil,
            created: Date(),
            description: "example",
            dtstart: .init(date: Date()),
            lastModified: Date(),
            location: "1",
            organizer: nil,
            priority: 1,
            seq: nil,
            status: "CONFIRMED",
            summary: "Spinning",
            transp: "SPAQUE",
            url: nil,
            dtend: nil,
            duration: nil,
            recurrenceID: Date(),
            rrule: nil,
            rdates: [Date(), Date(), Date()],
            exrule: nil,
            exdates: [Date(), Date()],
            alarms: [alarm],
            timeZone: nil,
            extendProperties: ["X-EXTEND-PROPERTY": "TEST"])

let vEncoded = event.vEncoded
        
print(vEncoded)

This will encode a VEvent to

BEGIN:VEVENT
DTSTAMP:20220305T092707Z
UID:[email protected]
CREATED:20220305T092707Z
DESCRIPTION:example
DTSTART:20220305T092707Z
LAST-MODIFIED:20220305T092707Z
LOCATION:1
PRIORITY:1
STATUS:CONFIRMED
SUMMARY:Spinning
TRANSP:SPAQUE
RECURRENCE-ID:20220305T092707Z
RRULE:FREQ=DAILY;INTERVAL=30;COUNT=3;BYMINUTE=10,30;BYDAY=1FR;WKST=SU
RDATE:20220305T092707Z
RDATE:20220305T092707Z
RDATE:20220305T092707Z
EXDATE:20220305T092707Z
EXDATE:20220305T092707Z
X-EXTEND-PROPERTY:TEST
BEGIN:VALAM
ACTION:AUDIO
TRIGGER:20220305T092707Z
DURATION:P0DT0H50M0S
END:VALAM
END:VEVENT

Decode a VEvent

let sampleICS = """
BEGIN:VEVENT
DTSTAMP:20220305T092707
UID:[email protected]
...
END:VALAM
END:VEVENT
"""

let parser = ICalParser()
let vEvents = parser.parseEvent(ics: sampleICS)
       
vEvents.forEach { vEvent in
    print(vEvent.vEncoded)
}
You might also like...
Custom Time Picker ViewController with Selection of start and end times in Swift 🔶
Custom Time Picker ViewController with Selection of start and end times in Swift 🔶

LFTimePicker Custom Time Picker ViewController with Selection of start and end times in Swift 🔶 . Based on Adey Salyard's design @ Dribbble One to tw

Timekeeper is an easy-to-use time measurement library written in Swift, with support for iOS, tvOS, watchOS and macOS.
Timekeeper is an easy-to-use time measurement library written in Swift, with support for iOS, tvOS, watchOS and macOS.

Timekeeper is an easy-to-use time measurement library written in Swift, with support for iOS, tvOS, watchOS and macOS. Installation Timekee

Date and time manager for iOS/OSX written in Swift
Date and time manager for iOS/OSX written in Swift

Tempo was designed to work both in OSX and in iOS (7.0+). Work with the time or dates can be cumbersome, iOS development. Tempo allows you to deal easly with date and time. Basics manipulations are already implemented in Tempo.

NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier.

NVDate is an extension of NSDate class (Swift4), created to make date and time manipulation easier. NVDate is testable and robust, we wrote intensive test to make sure everything is safe.

Dates and times made easy in iOS
Dates and times made easy in iOS

DateTools DateTools was written to streamline date and time handling in iOS. Classes and concepts from other languages served as an inspiration for Da

A "time ago", "time since", "relative date", or "fuzzy date" category for NSDate and iOS, Objective-C, Cocoa Touch, iPhone, iPad

Migration 2014.04.12 NSDate+TimeAgo has merged with DateTools. DateTools is the parent project and Matthew York is the project head. This project is n

SwiftUI library to display a clock. You can move the arms to change the time, change the style of the clock and customise some configurations.
SwiftUI library to display a clock. You can move the arms to change the time, change the style of the clock and customise some configurations.

SwiftClockUI Clock UI for SwiftUI This library has been tested ✅ 💻 macOS Catalina 10.15.3 ✅ 💻 macOS Big Sur 11.6 ✅ 📱 iOS 13 ✅ 📱 iOS 14 ✅ 📱 iOS 15

A customizable date picker for watchOS and SwiftUI.
A customizable date picker for watchOS and SwiftUI.

Watch Date Picker A customizable date picker for watchOS and SwiftUI. Installation .package(url: "https://github.com/freyaariel/watch-date-picker.git"

Time Lines - Know when all your friends, colleagues, and family are
Time Lines - Know when all your friends, colleagues, and family are

Time Lines Know when all your friends, colleagues, and family are. Time Lines is a practical app to know when all your friends, colleagues and family

Releases(1.1.0)
Owner
Jichan Park
iOS Developer
Jichan Park
A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.

TimeZonePicker A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your

Gligor Kotushevski 125 Dec 13, 2022
A basic countdown app that allows the user to create, edit, and delete events. Each event contains a live countdown timer to a specified date and time.

Event Countdown App (iOS) Created by Lucas Ausberger About This Project Created: January 4, 2021 Last Updated: January 8, 2021 Current Verison: 1.1.1

Lucas Ausberger 1 Jan 8, 2022
Create your own faces for watchOS. Customize the watch hands, layout, colors, and images. Edit faces on your phone and switch them on the watch.

AppleWatchFaces Design your own watch faces for the apple watch. They are not real watch faces, but a watchOS app running on the watch that tells you

Mike Hill 395 Oct 20, 2022
Sudoless Frequency Metric Retrieval for MacOS (Supports Apple Silicon and Intel CPUs and iGPUs)

SFMRM ('sifˌmərˌim) Sudoless Frequency Metric Retrieval for MacOS This project is designed to retrieve active frequency and residency metrics from you

BitesPotatoBacks 20 Dec 25, 2022
Time is a Swift package that makes dealing with calendar values a natural and straight-forward process.

Time Time is a Swift package that makes dealing with calendar values a natural and straight-forward process. Working with calendars can be extremely c

Dave DeLong 2k Dec 31, 2022
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!

Datez ?? Breeze through Date, DateComponents, and TimeInterval Highlights Two Custom Structs Only (value types FTW!): DateView: An Date associated wit

Kitz 263 Dec 7, 2022
SwiftDate 🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.

Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift. What's This? SwiftDate is the definitive toolchain to ma

Daniele Margutti 7.2k Jan 4, 2023
SwiftMoment - A time and calendar manipulation library for iOS 9+, macOS 10.11+, tvOS 9+, watchOS 2+ written in Swift 4.

SwiftMoment This framework is inspired by Moment.js. Its objectives are the following: Simplify the manipulation and readability of date and interval

Adrian Kosmaczewski 1.6k Dec 31, 2022
NTP library for Swift and Objective-C. Get the true time impervious to device clock changes.

TrueTime for Swift Make sure to check out our counterpart too: TrueTime, an NTP library for Android. NTP client for Swift. Calculate the time "now" im

Instacart 530 Jan 4, 2023
A Swift micro library for generating Sunrise and Sunset times.

Solar A Swift helper for generating Sunrise and Sunset times. Solar performs its calculations locally using an algorithm from the United States Naval

Chris Howell 493 Dec 25, 2022