Git Product home page Git Product logo

jkcalendar's Introduction

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

jkcalendar's People

Contributors

joeciou avatar dungi avatar muizidn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.