YMCalendar

YMCalendar

YMCalendar is a library of monthly event calendar for iOS written in Swift 3.

screenshots

demo_gif

Usage

Property

YMCalendarView has some instance properties like UICollectionView.

  • Scrollable both vertically and horizontally
  • Switching paging mode
  • Multiple selection mode
  var scrollDirection: YMScrollDirection
  var isPagingEnabled: Bool
  var allowsMultipleSelection: Bool
  • Customizable select and deselect animation.
enum YMSelectAnimation {
    case none, bounce, fade
}

var selectAnimation: YMSelectAnimation
var deselectAnimation: YMSelectAnimation
  • Customizable date range of calendarView.
func setDateRange(_ dateRange: DateRange?)

If you set nil for dateRange, it will be inifinite scroll calendar (default is nil).

Layout customization

Appearance protocol

YMCalendarView has appearance property of YMCalendarAppearance protocol which manages layout for YMCalendarView.
For example, color and width of grid lines, color and fonts of day labels on calendarView.

func horizontalGridColor(in view: YMCalendarView) -> UIColor
func horizontalGridWidth(in view: YMCalendarView) -> CGFloat
func verticalGridColor(in view: YMCalendarView) -> UIColor
func verticalGridWidth(in view: YMCalendarView) -> CGFloat
    
func dayLabelAlignment(in view: YMCalendarView) -> YMDayLabelAlignment
func calendarViewAppearance(_ view: YMCalendarView, dayLabelFontAtDate date: Date) -> UIFont
func calendarViewAppearance(_ view: YMCalendarView, dayLabelTextColorAtDate date: Date) -> UIColor
func calendarViewAppearance(_ view: YMCalendarView, dayLabelBackgroundColorAtDate date: Date) -> UIColor

## GitHub

<div class="github-widget" data-repo="matsune/YMCalendar"></div>