- July 15, 2025
- Mins Read
You can use CocoaPods to install ASCalendar
by adding it to your Podfile
:
platform :ios, ‘8.0’
use_frameworks!
pod ‘ASCalendar’
To get the full benefits import ASCalendar
wherever you import UIKit
import UIKit
import ASCalendar
/Example/Calendar
folder in your project.
let calendar = ASCalendar()
calendar.showCalendarAsLayer()
calendar.delegate = self
func calendarSelect(day: Int, week: Int, month: Int, year: Int) {
NSLog(“%d-%d-%d (%d)”, day, month, year, week)
}
-to close the calendar the user can tap outside it (like a popover) or you can manually close it calling:
calendar.hideCalendar()
calendar.setSelectionStyle(.Week)
calendar.setSundayFirstWeekDay(true)
//or
calendar.setMondayFirstWeekDay(false)
//month: 06, year: 2035
calendar.setcurrentPage(6, year: 2035)
//the range will start by day:15 month: 02, year: 2018
calendar.setFirstSelectableDate(15, month: 2, year: 2018)
//the upper limit of the selectable range will be day:20 month: 02, year: 2018
calendar.setLastSelectableDate(20, month: 2, year: 2018)
//set day or week selected by day:13 month: 04, year: 2044
calendar.setSelectedDay(13, month: 04, year: 2044)
func configureHeader(backgroundColor: UIColor?, textColor: UIColor?, textFont : UIFont?, separationLineColor: UIColor?)
func configureBodyHeader(backgroundColor: UIColor?, textColor: UIColor?, textFont: UIFont?, separationLineColor: UIColor?)
func configureBody(backgroundColor: UIColor?, monthTextColor: UIColor?, monthTextFont: UIFont?, separationLineColor: UIColor?)
func configureDay(selectableTextColor: UIColor?, unselectableTextColor: UIColor?, selectedTextColor: UIColor?, TextFont: UIFont?)
func configureSelections(selectionColor: UIColor?, daySelectionSize: CGFloat?, weekSelectionHeight: CGFloat?)
calendar.theme.defaults(index)