<commit_before>![CalendarKit](https://user-images.githubusercontent.com/8013017/78410561-617a0980-7615-11ea-9e83-82cd9981960c.jpg)
[![License](https://img.shields.io/cocoapods/l/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![Platform](https://img.shields.io/cocoapods/p/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![Version](https://img.shields.io/cocoapods/v/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-orange.svg)](#swift-package-manager) 



# CalendarKit
**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](https://stackoverflow.com/questions/tagged/calendarkit) tag.

Please, use [GitHub Issues](https://github.com/richardtop/CalendarKit/issues) only for reporting a **bug** or requesting a new **feature** in the library.


## Demo
You can try CalendarKit with CocoaPods. Just enter in Terminal:
```ruby
pod try CalendarKit
```
[Watch demo video](https://streamable.com/zsnu1)

[Try it live in your browser](https://appetize.io/app/k85kqpdr1fp79e59f1c4ar8cx4)



## Installation


**CalendarKit** is available through [Swift Package Manager](https://swift.org/package-manager) or [CocoaPods](http://cocoapods.org).

### Swift Package Manager (Xcode 11 or higher)

Open your project, select `File > Swift Packages > Add Package Depedency` and copy the [repository URL](https://github.com/richardtop/CalendarKit.git) into the search bar.

A more detailed guide can be found here: [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app)

### CocoaPods

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

```ruby
pod 'CalendarKit'
```


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

```swift
// Return an array of EventDescriptors for particular date
override func eventsForDate(_ date: Date) -> [EventDescriptor] {
  var models = // Get events (models) from the storage / API
<commit_msg>Add detailed SPM instructions<commit_after>![CalendarKit](https://user-images.githubusercontent.com/8013017/78410561-617a0980-7615-11ea-9e83-82cd9981960c.jpg)
[![License](https://img.shields.io/cocoapods/l/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![Platform](https://img.shields.io/cocoapods/p/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![Version](https://img.shields.io/cocoapods/v/CalendarKit.svg?style=flat)](http://cocoadocs.org/docsets/CalendarKit)
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-orange.svg)](#swift-package-manager) 



# CalendarKit
**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](https://stackoverflow.com/questions/tagged/calendarkit) tag.

Please, use [GitHub Issues](https://github.com/richardtop/CalendarKit/issues) only for reporting a **bug** or requesting a new **feature** in the library.


## Demo
You can try CalendarKit with CocoaPods. Just enter in Terminal:
```ruby
pod try CalendarKit
```
[Watch demo video](https://streamable.com/zsnu1)

[Try it live in your browser](https://appetize.io/app/k85kqpdr1fp79e59f1c4ar8cx4)



## Installation
### Swift Package Manager (Xcode 11 or higher)

The preferred way of installing CalendarKit is via the [Swift Package Manager](https://swift.org/package-manager/).

>Xcode 11 integrates with libSwiftPM to provide support for iOS, watchOS, and tvOS platforms.

1. In Xcode, open your project and navigate to **File** → **Swift Packages** → **Add Package Dependency...**
2. Paste the repository URL (`https://github.com/richardtop/CalendarKit.git`) and click **Next**.
3. For **Rules**, select **Branch** (with branch set to `master`).
4. Click **Finish**.

A more detailed guide can be found here: [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app)

### CocoaPods

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

```ruby
pod 'CalendarKit'
```


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

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

{'fraction_non_alphanumeric': 0.11699819168173599, 'fraction_numerical': 0.02061482820976492, 'mean_word_length': 5.491784037558685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '995299', 'n_tokens_mistral': 1783, 'n_tokens_neox': 1590, 'n_words': 518}