Latest 0.1.0
Homepage https://github.com/deirinberg/MDCalendarSelector
License MIT
Platforms ios 8.0, requires ARC
Dependencies PureLayout
Frameworks UIKit
Authors

Pod Version
Pod License
Pod Platform

MDCalendarSelector is a lightweight customizable view that allows you to easily select a range of dates.

Installation

From CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C, which automates and simplifies the process of using 3rd-party libraries like MDCalendarSelector in your projects. Simply add the following lines to your Podfile:

  use_frameworks!
  pod 'MDCalendarSelector'

Manually

Drag the MDCalendarSelector/MDCalendarSelector folder into your project.

Usage

(see sample Xcode project in /Demo)

Declare and initialize MDCalendarSelector like a normal view. Add an MDCalendarSelectorDelegate to your class to listen to changes to the selected date range.

  var calendarSelector = MDCalendarSelector();
  calendarSelector.delegate = self;

Delegate Methods

  func calendarSelector(calendarSelector: MDCalendarSelector, startDateChanged startDate: NSDate)
  func calendarSelector(calendarSelector: MDCalendarSelector, endDateChanged endDate: NSDate)

Customization

MDCalendarSelector can be customized by editing the following properties:

  var backgroundViewColor: UIColor // background color of the calendar, default is UIColor.blackColor()
  var highlightedColor: UIColor    // background color of header and of selected days, default is UIColor.redThemeColor()
  var dateTextColor: UIColor  // text color of days that can be selected, default is UIColor.whiteColor()
  var nextDateTextColor: UIColor  // text color of days that are in a different month, default is UIColor(white: 1.0, alpha: 0.5)
  var disabledTextColor: UIColor  // text color of days that are disabled, default is UIColor(white: 1.0, alpha: 0.3)
  var highlightedTextColor: UIColor // text color of selected days and header month, default is UIColor.whiteColor()
  var maxRange: UInt  // max amount of days that can be selected, default is 21

  var regularFontName: String?  // font name for all regular text, default font is the systemFont
  var boldFontName: String? // font name for all bold text, default font is the boldSystemFont
  var headerFontSize: CGFloat // font size for the headerLabel text, default is 15.0
  var dateFontSize: CGFloat  // font size for dates, default is 13.0

Other Readonly Properties and Functions

var startDate: NSDate // initial date of selected range
var endDate: NSDate // last date of selected range
var selectedLength: Int // length of selected date range

func goToToday() // reset selected date to today

Examples

MDCalendarSelector was initially used in an app I created, In the Loop.

Latest podspec

{
    "name": "MDCalendarSelector",
    "version": "0.1.0",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "Lightweight multidate calendar selector for iOS",
    "homepage": "https://github.com/deirinberg/MDCalendarSelector",
    "license": "MIT",
    "authors": {
        "Dylan Eirinberg": "[email protected]"
    },
    "source": {
        "git": "https://github.com/deirinberg/MDCalendarSelector.git",
        "commit": "732929b2ec30698ccac7cdb0d8c3be39ab16a158",
        "tag": "0.1.0"
    },
    "description": "Easily select a range of dates in a lightweight easy to customize view.",
    "source_files": "MDCalendarSelector/*.{swift}",
    "frameworks": "UIKit",
    "dependencies": {
        "PureLayout": [
            "~> 3.0"
        ]
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This