TimesSquare is a powerful date picker and calendar library for iOS applications that provides a user-friendly interface for selecting dates and managing events on a calendar.


[sudo] gem install cocoadocs


  • iOS 10.0+
  • Xcode 11.0+
  • Swift 5.0+

Getting Started

To get started with TimesSquare, follow these steps:

import TimesSquare


1. Displaying the Calendar

To display the calendar, you can use the following code:

let calendarView = CalendarView(frame: CGRect(x: 0, y: 0, width: 320, height: 400))

This creates a new instance of the CalendarView, sets its frame, and adds it as a subview to the current view controller’s view.

2. Customizing the Appearance

You can customize the appearance of the calendar by using properties and methods provided by the CalendarView class. For example:

calendarView.backgroundColor = UIColor.white
calendarView.headerBackgroundColor = UIColor.red
calendarView.headerTextColor = UIColor.white

This code changes the background color of the calendar, the background color of the header, and the text color of the header.

3. Handling Selection

To handle date selection events, you can implement the following delegate method:

extension MyViewController: CalendarViewDelegate {
    func calendarView(_ calendarView: CalendarView, didSelectDate date: Date) {
        // Handle date selection

This delegate method is called when a date is selected in the calendar. You can implement your own logic to handle the selected date.

4. Managing Events

You can add and manage events on the calendar by using the following methods:

calendarView.addEvent(event: "Meeting", date: Date())
calendarView.removeEvent(event: "Meeting", date: Date())

This code adds a new event called “Meeting” on the current date, and then removes it from the same date.


1. DatePicker

The following code shows how to use the TimesSquare DatePicker:

let datePicker = UIDatePicker(frame: CGRect(x: 0, y: 0, width: 320, height: 216))
datePicker.datePickerMode = .date
textField.inputView = datePicker

This code creates a new instance of the UIDatePicker with a specified frame and sets its datePickerMode to .date. Then it assigns the datePicker as the inputView of a textField, allowing the user to select a date from the picker when editing the textField.

2. Event Scheduling

The following code demonstrates how to schedule an event using TimesSquare:

calendarView.addEvent(event: "Meeting", date: selectedDate)

This code adds an event named “Meeting” on the selectedDate specified by the user.


TimesSquare is a versatile date picker and calendar library that allows developers to easily integrate and customize calendar functionality in their iOS applications. It provides a user-friendly interface for selecting dates and managing events, making it a valuable tool for any app that requires date-related features.