EKEventKit.Example
Simple example project showing basic parts of Event Kit like loading events from calendar, selecting calendar, editing events..
Install / Use
/learn @nemecek-filip/EKEventKit.ExampleREADME
EKEventKit Example
You can read more about EventKit on my website.
SwiftUI version is currently work in progress. Feel free to help and suggest improvements. I have so far done just a little of SwiftUI..
Simple example project showing basic parts of Event Kit like loading events from calendar, selecting calendar, editing events..
📅 This project shows loading EKEvents from EKEventStore and accessing their properties to display calendar events in a Table View. It also demonstrates usage of EKCalendarChooser to let user choose calendars whose events to display. Events are added and edited via EKEventEditViewController. Events with location can be displayed on a map.
Not related stuff includes using NSTextAttachment inside NSAttributedString to display calendar colors with tinted images. And also how to implement swipe to delete in Table View with custom icon with the trailingSwipeActionsConfigurationForRowAt method.

I also have smaller projects showing EKCalendarChooser and EKEventEditViewController.
Quick overview of examples in the project
Loading calendar events
let weekFromNow = Date().advanced(by: TimeInterval.week)
let predicate = eventStore.predicateForEvents(withStart: Date(), end: weekFromNow, calendars: Array(selectedCalendars))
events = eventStore.events(matching: predicate)
Requesting calendar access
eventStore.requestAccess(to: .event) { (granted, error) in
if granted {
DispatchQueue.main.async {
self.loadEvents()
self.displaySelectedCalendars()
}
}
}
Selecting calendars with the EKCalendarChooser
let chooser = EKCalendarChooser(selectionStyle: .multiple, displayStyle: .allCalendars, entityType: .event, eventStore: eventStore)
chooser.delegate = self
chooser.showsDoneButton = true
chooser.showsCancelButton = true
chooser.selectedCalendars = selectedCalendars
let nvc = UINavigationController(rootViewController: chooser)
present(nvc, animated: true, completion: nil)
Implementing EKCalendarChooserDelegate
extension ViewController: EKCalendarChooserDelegate {
func calendarChooserDidFinish(_ calendarChooser: EKCalendarChooser) {
dismiss(animated: true, completion: nil)
selectedCalendars = calendarChooser.selectedCalendars
displaySelectedCalendars()
loadEvents()
}
func calendarChooserDidCancel(_ calendarChooser: EKCalendarChooser) {
dismiss(animated: true, completion: nil)
}
}
Convenience EKEvent extensions:
extension EKEvent {
var hasGeoLocation: Bool {
return structuredLocation?.geoLocation != nil
}
var isBirthdayEvent: Bool {
return birthdayContactIdentifier != nil
}
}
Not seeing anything?
If the device or simulator has not initialized the Calendar app, the default calendar does not exist. Open the Calendar app on the device or simulated device. Build and run the app again.
Other stuff to check out
- Example project showing Quick Look framework: Usage of
QLPreviewControllerandQLPreviewGeneratorto display and generate previews of various files like PDF, Pages documents, Keynote presentation, images and more. - Dynamic Type - Reference App to quickly preview Dynamic Type fonts so you can visualize them instead of just guessing.
- App Ideas repo with some ideas for apps to build :-)
- Keyboard Preview - small app to preview all available keyboard settings in iOS.
- More to come
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
