/SSCalendarControl

SSCalendarControl is small and highly customizable calendar control written in swift.

Primary LanguageSwiftMIT LicenseMIT

SSCalendarControl

SSCalendarControl is small and highly customizable calendar control written in swift.

Swift Version Build Status License Platform PRs Welcome

Alt text

Features!

  • Customizable control
  • Flexible date range
  • Customizable week day
  • Selection delegates
  • Customizable month and days cells
  • CocoaPods

Requirements

  • iOS 10.0+
  • Xcode 9+

Installation

  • You can use CocoaPods to install SSCalendarControl by adding it to your Podfile:

     use_frameworks!
     pod 'SSCalendarControl'
    
  •  import UIKit
     import SSCalendarControl
    

Manually

  • Download and drop SSCalendarControl folder in your project.
  • Congratulations!

Usage example

  • In the storyboard add a UIView and change its class to SSCalendarView Alt text

Setup Calendar

calendarView.setUpCalendar(startDate: startDate, endDate: endDate, weekStartDay: .monday, shouldSelectPastDays: true, sholudAllowMultipleSelection: false)

Weekday Customization

calendarView.configuration.weekDayBorderColor = UIColor.black
calendarView.configuration.weekDayLabelBackgroundColor = UIColor.clear
calendarView.configuration.weekDayLabelTextColor = UIColor.black

Month Customization

calendarView.configuration.monthViewBackgroundColor = UIColor.white
calendarView.configuration.monthViewBottomLineColor = UIColor.darkGray
calendarView.configuration.monthLabelFont = UIFont.systemFont(ofSize: 20)
calendarView.configuration.monthLabelTextColor = UIColor.red

Days Customization

calendarView.configuration.previousDayTextColor = UIColor.black
calendarView.configuration.previousDayBorderColor = UIColor.clear
calendarView.configuration.upcomingDaysBorderColor = UIColor.clear
calendarView.configuration.upcomingDaysBorderColor = UIColor.clear
calendarView.configuration.upcomingDayTextColor = UIColor.brown
calendarView.configuration.selectedDayTextColor = UIColor.yellow
calendarView.configuration.currentDayBorderColor = UIColor.black
calendarView.configuration.currentDayTextColor = UIColor.white
calendarView.configuration.currentDayBackgroundColor = UIColor.red

Selection Delegates

calendarView.delegate = self

extension ViewController: SSCalendarDeleagte {

    func dateSelected(_ date: Date) {
        print("selected: \(date)")
    }

    func dateDeSelected(_ date: Date) {
        print("deSelected: \(date)")
    }
}

Contribute

  • We would love you for the contribution to SSCalendarControl, check the LICENSE file for more info.

Meta

  • Distributed under the MIT license. See LICENSE for more information.