Skip to content

vinod1988/CalendarKit

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CalendarKit CI Status Version License Platform

CalendarKit

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

Try it

You can try CalendarKit using CocoaPods. Just enter this line in Terminal:

pod try CalendarKit

Or watch it live in this video

Installation

CalendarKit is available through CocoaPods. To install it, simply add the following lines to your Podfile:

pod 'CalendarKit'
pod 'DateTools', :git => 'https://github.com/MatthewYork/DateTools.git', :branch => 'swift'

For now, it is required to specify DateTools swift branch, as it is still in beta. When swift version of DateTools is released, this line could be removed.

Usage

Subclass DayViewController and implement DayViewDataSource protocol to show events

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

  var views = [EventView]()

  for event in events {
      // Create new EventView
      let view = EventView()
      // Specify TimePeriod
      view.datePeriod = TimePeriod(beginning: event.beginning, end: event.start)
      // Add info: event title, subtitle, location to the array of Strings
      var info = [event.title, event.location]
      info.append("\(datePeriod.beginning!.format(with: "HH:mm")!) - \(datePeriod.end!.format(with: "HH:mm")!)")
      view.data = info
      views.append(view)
  }

  return views
}

There is no need to do layout, CalendarKit will take care of it.

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)")
}

Localization

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:

Finnish


German


Norwegian

Requirements

  • iOS 9.0+
  • Swift 3.0+

Dependencies

  • Neon is used for declarative layout
  • DateTools is used for date manipulation
  • DynamicColor is used to update the colors of Events

Roadmap

CalendarKit is under development, API can and will be changed.

  • Improve customization
  • Landscape support
  • Add to Carthage
  • Documentation

Author

Richard Topchii

License

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

About

๐Ÿ“… Fully customizable calendar for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.0%
  • Ruby 2.7%
  • Objective-C 0.3%