Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeciou/jkcalendar
Calendar library for iOS
https://github.com/joeciou/jkcalendar
calendar date ios ios-swift swift swift3 swift4 ui ui-design
Last synced: 3 months ago
JSON representation
Calendar library for iOS
- Host: GitHub
- URL: https://github.com/joeciou/jkcalendar
- Owner: JoeCiou
- License: mit
- Created: 2017-04-17T03:11:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-30T09:41:49.000Z (over 5 years ago)
- Last Synced: 2024-10-12T14:23:03.141Z (3 months ago)
- Topics: calendar, date, ios, ios-swift, swift, swift3, swift4, ui, ui-design
- Language: Swift
- Homepage:
- Size: 2.79 MB
- Stars: 90
- Watchers: 6
- Forks: 17
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JKCalendar
![](https://travis-ci.org/JoeCiou/JKCalendar.svg?branch=master)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Version](https://img.shields.io/cocoapods/v/JKCalendar.svg)](http://cocoadocs.org/docsets/JKCalendar)
[![Platform](https://img.shields.io/cocoapods/p/JKCalendar.svg)](http://cocoadocs.org/docsets/JKCalendar)
[![Swift 3.x](https://img.shields.io/badge/Swift-3.x-orange.svg?style=flat)](https://swift.org/)
[![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://swift.org/)
## Screenshot
## Requirements
- iOS 9.0+
- Xcode 8+## Installation
#### CocoaPods
To install add the following line to your `Podfile`:
```ruby
pod 'JKCalendar'
```#### Carthage
To install add the following line to your `Cartfile`:
```ruby
github "JoeCiou/JKCalendar"
```## Usage
Firstley, import `JKCalendar`
```swift
import JKCalendar
```### Initialization
Then, there are to two ways you can create JKCalendar:
- By storyboard, change class of any `UIView` to JKCalendar_**Note:** Set Module to `JKCalendar`._
- By code, using initializer.
```swift
let calendar = JKCalendar(frame: frame)
```### Mark
```swift
public enum JKCalendarMarkType{
case circle
case hollowCircle
case underline
case dot
}
```
For single mark:
For continuous mark:#### Examples
Firstley, Setup data source:
```swift
calendar.dataSource = self
```
For single mark:
```swift
func calendar(_ calendar: JKCalendar, marksWith month: JKMonth) -> [JKCalendarMark]? {
let today = JKDay(date: Date())
if today == month{
return [JKCalendarMark(type: .underline, day: today, color: UIColor.red)]
}else{
return nil
}
}
```
For continuous mark:
```swift
func calendar(_ calendar: JKCalendar, continuousMarksWith month: JKMonth) -> [JKCalendarContinuousMark]?{
let markStartDay = JKDay(year: 2017, month: 9, day: 3)!
let markEndDay = JKDay(year: 2017, month: 9, day: 12)!
if markStartDay == month || markEndDay == month{
return [JKCalendarContinuousMark(type: .circle, start: markStartDay, end: markEndDay, color: UIColor.red)]
}else{
return nil
}
}
```## License
The MIT License (MIT)copyright (c) 2017 Joe Ciou