JKCalendar 1.1.4

JKCalendar 1.1.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2019
SPMSupports SPM

Maintained by JoeCiou.



  • By
  • JoeCiou

JKCalendar

Carthage compatible Version Platform Swift 3.x Swift 4.0

Screenshot

Requirements

  • iOS 9.0+
  • Xcode 8+

Installation

CocoaPods

To install add the following line to your Podfile:

pod 'JKCalendar'

Carthage

To install add the following line to your Cartfile:

github "JoeCiou/JKCalendar"

Usage

Firstley, import JKCalendar

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.
let calendar = JKCalendar(frame: frame)

Mark

public enum JKCalendarMarkType{
    case circle
    case hollowCircle
    case underline
    case dot
}

For single mark: For continuous mark:

Examples

Firstley, Setup data source:

calendar.dataSource = self

For single mark:

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:

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