Skip to content

Styling

Michael Michailidis edited this page Oct 9, 2019 · 5 revisions

To style the Karmadust Calendar you can create a CalendarView.Style object and set it to the right values. Then pass it to the calendar at any time like so:

let myStyle = CalendarView.Style()
myStyle.cellBorderColor = UIColor.black
myStyle.cellBorderWidth = 2.0
// set more properties
self.calendarView.style = myStyle

The calendar also comes with a global default style that is publicly accessed via CalendarView.Style.Default. This style will apply to all calendars that have no explicit style set.

Cell Shape

You can fully customize the roundness of day cells by setting the cellShape property to a CalendarView.Style.CellShapeOptions value:

myStyle.cellShape = CalendarView.Style.CellShapeOptions.round

The code above will set the cell as shown in the middle of the three instances below:

For the other two you need to set the variable to CalendarView.Style.CellShapeOptions.bevel and associate a value that defines the amount of bevel you desire.

myStyle.cellShape = CalendarView.Style.CellShapeOptions.bevel(4.0)
Clone this wiki locally