Swiftpack.co - Package - richardtop/CalendarKit

CalendarKit License Platform Version SwiftPM compatible


CalendarKit is a fully customizable calendar library written in Swift. It was designed to look similar to the iOS Calendar app, but allow customization if needed. To make modifications easier, CalendarKit is composed of multiple small modules. They can be used together, or on their own.

Need Help?

If you have a programming question about how to use CalendarKit in your application, ask it on StackOverflow using the CalendarKit tag.

Please, use GitHub Issues only for reporting a bug or requesting a new feature in the library.


You can try CalendarKit with CocoaPods. Just enter in Terminal:

pod try CalendarKit

Watch demo video

Try it live in your browser


Swift Package Manager (Xcode 12 or higher)

The preferred way of installing CalendarKit is via the Swift Package Manager.

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency...
  2. Paste the repository URL (https://github.com/richardtop/CalendarKit.git) and click Next.
  3. For Rules, select Version (Up to Next Major) and click Next.
  4. Click Finish.

A more detailed guide can be found here: Adding Package Dependencies to Your App


To install it, add the following line to your Podfile:

pod 'CalendarKit'


Subclass DayViewController and implement EventDataSource protocol to show events. CalendarKit requires EventDataSource to return an array of objects conforming to EventDescriptor protocol, specifying all the information needed to display a particular event:

// Return an array of EventDescriptors for particular date
override func eventsForDate(_ date: Date) -> [EventDescriptor] {
  var models = // Get events (models) from the storage / API

  var events = [Event](https://raw.github.com/richardtop/CalendarKit/master/)

  for model in models {
      // Create new EventView
      let event = Event()
      // Specify StartDate and EndDate
      event.startDate = model.startDate
      event.endDate = model.endDate
      // Add info: event title, subtitle, location to the array of Strings
      var info = [model.title, model.location]
      info.append("\(datePeriod.beginning!.format(with: "HH:mm")) - \(datePeriod.end!.format(with: "HH:mm"))")
      // Set "text" value of event by formatting all the information needed for display
      event.text = info.reduce("", {$0 + $1 + "\n"})
  return events

There is no need to do layout, CalendarKit will take care of it. CalendarKit also creates EventViews for you and reuses them.

If needed, implement DayViewDelegate to handle user input

override func dayViewDidSelectEventView(_ eventView: EventView) {
  print("Event has been selected: \(eventview.data)")

override func dayViewDidLongPressEventView(_ eventView: EventView) {
  print("Event has been longPressed: \(eventView.data)")


CalendarKit supports localization and uses iOS default locale to display month and day names. First day of the week is also selected according to iOS locale. Here are few examples:


CalendarKit's look can be easily customized. The steps needed for customizations are as follows:

  1. Create a new CalendarStyle object (or copy existing one)
  2. Change style by updating the properties.
  3. Invoke updateStyle method with the new CalendarStyle.
let style = CalendarStyle()
style.backgroundColor = UIColor.black


  • iOS 9.0+
  • Swift 4+ (Library is written in Swift 5)


The list of features currently in development can be viewed on the issues page.

Before contributing, please review guidelines and code style.


Richard Topchii


CalendarKit is available under the MIT license. See the LICENSE file for more info.


Stars: 1584


Used By

Total: 0


Removed dependencies from CalendarKit -

Updated library API -

This version contains updated library API. Methods and properties that are not recommended to be used by the clients are hidden with the private keyword now. On the other hand, a big portion of the library has been exposed with the public modifiers, so that it's now possible to use CalendarKit's components to create an own custom user interface.


Improved gesture recognition in EventViews -

Add support for resize handles when editing an event -

Improved editing API -

Improved localization -

AM/PM symbols localized "all-day" localized

API Improvements: Editing & Styling -

  1. Moved CalendarStyle to use structs instead of classes with NSCopying protocol support.
  2. It is possible to move an event to the day before or after the currently visible on a timeline by dragging past midnight, either all the way up or down.
  3. Fix fo issue #159

Pass date in the tap gesture recognizer delegate callbacks -

Now CalendarKit passes the date which has been tapped on the timeline. Breaking API change:


func timelinePagerDidTap(timelinePager: TimelinePagerView)
func dayViewDidTapTimeline(dayView: DayView)


func timelinePagerDidTap(timelinePager: TimelinePagerView, date: Date)
func dayViewDidTapTimeline(dayView: DayView, date: Date)

Issue #224

Snapping behavior when editing events -

  1. Add snapping behavior when editing events
  2. Create internal properties to expose snapping behavior as a public API later

Improve Dark Mode compatibility -

Improve Dark Mode compatibility Update example Dark style

Minor API updates -

Editing & Event Creation Support -

CalendarKit has new API which now supports event editing and creation.

Fullscreen layout fix -

Fixed issue #187.

Bugfixes -

Fixed issues: #206, #207, #208.

Custom Calendar -

Now CalendarKit supports custom calendar.

Introduce UIPageViewController -

Introduce UIPageViewController to the CalendarKit

Swift 5 -

Swift 5 Support EventGap support https://github.com/richardtop/CalendarKit/pull/190

Version update -

Swift 4.2 -

Fixed scrollToFirstEvent bug -

Fixed scrollToFirstEvent bug #169

Overlapping events, custom hour height -

#165, #166

Fix TimeZone issue -

Fix for #164

Add All-Day Events -

Update to Swift 4.1 -

Remove DateTools from external interface -

PR: #139 Issue: #132

Now, events have both startDate and endDate instead of the TimePeriod:

let model = __get_model()
event.startDate = model.startDate
event.endDate = model.endDate

Feature/iPad header -

Added support for both compact and regular size classes in the Header. #136

Fix overscroll on TimelineContainer -

Fix overscroll on TimelineContainer PR: #135, issue #127

Bugfix: crash if current date is close to the New Year -

Fixed issue described in #128: CalendarKit is crashing on new year. The DayHeaderView is not getting set correctly and when we navigate by swiping left or right, the app crashes.

Improve integration -

  1. Made a number classes, properties and functions public to cater for different users' needs
  2. Added example with a Notification view

12/24 hour support -

  1. 12/24 hour support, #86