# mijick/calendarview architecture

> Architecture diagram of the GitHub repository mijick/calendarview, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mijick/calendarview
- Repository: https://github.com/mijick/calendarview

## Overview

CalendarView is a SwiftUI library for rendering customizable month calendars with optional selected-date and date-range bindings. An app supplies those bindings and a configuration; the public initializer creates the calendar view, which generates month data, displays weekday and month headers, and renders each month. Day cells provide selection and range visuals, while public view protocols let callers replace calendar elements. Date, weekday, formatting, and range models support rendering. The tree and sampled source establish the main entry and rendering calls; some internal implementations, including month-cell rendering and selection-state storage, were not sampled, so their wiring is left conservative.

Main entry points: [`Sources/Internal/Views/MCalendarView.swift`](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/MCalendarView.swift) (Calendar View), [`Sources/Public/View Protocols/Public+DayView.swift`](https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BDayView.swift) (Day View Protocol), [`Sources/Public/Extensions/Public+MCalendarView.swift`](https://github.com/mijick/calendarview/blob/main/Sources/Public/Extensions/Public%2BMCalendarView.swift) (Calendar Initializer), [`Sources/Internal/Data/Data.MonthView.swift`](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Data/Data.MonthView.swift) (Month Grid Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_calendar_init["Calendar Initializer"]
end

subgraph group_render["Calendar Rendering"]
  node_calendar_view["Calendar View"]
  node_month_view["Month Renderer<br/>[MonthView.swift]"]
  node_default_day["Default Day View"]
  node_weekday_view["Weekday Header"]
end

subgraph group_domain["Calendar Data"]
  node_month_data["Month Grid Data"]
  node_calendar_model["Calendar Settings<br/>[MCalendar.swift]"]
  node_selection_state["Selection State"]
  node_range_model["Date Range<br/>[MDateRange.swift]"]
  node_date_helpers["Date Helpers<br/>[Date++.swift]"]
  node_date_formatter["Date Formatter"]
  node_weekday_symbols["Weekday Symbols"]
end

subgraph group_custom["Customization"]
  node_day_protocol["Day View Protocol"]
  node_weekday_label["Weekday Label"]
  node_month_label["Month Label"]
  node_calendar_config["Calendar Config"]
end

node_app(("App"))

node_app -->|"creates"| node_calendar_init
node_calendar_init -->|"initializes"| node_calendar_view
node_calendar_init -->|"configures"| node_calendar_config
node_calendar_view -->|"generates"| node_month_data
node_month_data -->|"reads settings"| node_calendar_model
node_calendar_view -->|"initializes"| node_selection_state
node_calendar_view -->|"renders months"| node_month_view
node_calendar_view -->|"renders header"| node_weekday_view
node_calendar_view -->|"creates labels"| node_month_label
node_calendar_config -->|"selects view"| node_weekday_view
node_month_view -->|"renders cells"| node_day_protocol
node_day_protocol -->|"provides defaults"| node_default_day
node_day_protocol -->|"checks range"| node_range_model
node_day_protocol -->|"formats dates"| node_date_formatter
node_month_data -->|"calculates dates"| node_date_helpers
node_date_helpers -->|"uses settings"| node_calendar_model
node_weekday_view -->|"renders labels"| node_weekday_label
node_weekday_label -->|"uses symbols"| node_weekday_symbols

click node_calendar_init "https://github.com/mijick/calendarview/blob/main/Sources/Public/Extensions/Public%2BMCalendarView.swift"
click node_calendar_view "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/MCalendarView.swift"
click node_month_data "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Data/Data.MonthView.swift"
click node_calendar_model "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Models/MCalendar.swift"
click node_selection_state "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Data/Data.MCalendarView.swift"
click node_month_view "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/MonthView.swift"
click node_day_protocol "https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BDayView.swift"
click node_default_day "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/Default/DefaultDayView.swift"
click node_weekday_view "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/Default/DefaultWeekdaysView.swift"
click node_weekday_label "https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BWeekdayLabel.swift"
click node_month_label "https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BMonthLabel.swift"
click node_calendar_config "https://github.com/mijick/calendarview/blob/main/Sources/Public/Configurables/Public%2BCalendarConfig.swift"
click node_range_model "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Models/MDateRange.swift"
click node_date_helpers "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Extensions/Date%2B%2B.swift"
click node_date_formatter "https://github.com/mijick/calendarview/blob/main/Sources/Internal/Helpers/MDateFormatter.swift"
click node_weekday_symbols "https://github.com/mijick/calendarview/blob/main/Sources/Public/Enums/Public%2BMWeekday.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_calendar_init toneBlue
class node_calendar_view,node_month_view,node_default_day,node_weekday_view toneAmber
class node_month_data,node_calendar_model,node_selection_state,node_range_model,node_date_helpers,node_date_formatter,node_weekday_symbols toneMint
class node_day_protocol,node_weekday_label,node_month_label,node_calendar_config toneRose
class node_app toneIndigo
```

## Components

### Public API

- [Calendar Initializer](https://github.com/mijick/calendarview/blob/main/Sources/Public/Extensions/Public%2BMCalendarView.swift): `Sources/Public/Extensions/Public+MCalendarView.swift`

### Calendar Rendering

- [Calendar View](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/MCalendarView.swift): `Sources/Internal/Views/MCalendarView.swift`
- [Month Renderer](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/MonthView.swift): `Sources/Internal/Views/MonthView.swift`
- [Default Day View](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/Default/DefaultDayView.swift): `Sources/Internal/Views/Default/DefaultDayView.swift`
- [Weekday Header](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Views/Default/DefaultWeekdaysView.swift): `Sources/Internal/Views/Default/DefaultWeekdaysView.swift`

### Calendar Data

- [Month Grid Data](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Data/Data.MonthView.swift): `Sources/Internal/Data/Data.MonthView.swift`
- [Calendar Settings](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Models/MCalendar.swift): `Sources/Internal/Models/MCalendar.swift`
- [Selection State](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Data/Data.MCalendarView.swift): `Sources/Internal/Data/Data.MCalendarView.swift`
- [Date Range](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Models/MDateRange.swift): `Sources/Internal/Models/MDateRange.swift`
- [Date Helpers](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Extensions/Date%2B%2B.swift): `Sources/Internal/Extensions/Date++.swift`
- [Date Formatter](https://github.com/mijick/calendarview/blob/main/Sources/Internal/Helpers/MDateFormatter.swift): `Sources/Internal/Helpers/MDateFormatter.swift`
- [Weekday Symbols](https://github.com/mijick/calendarview/blob/main/Sources/Public/Enums/Public%2BMWeekday.swift): `Sources/Public/Enums/Public+MWeekday.swift`

### Customization

- [Day View Protocol](https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BDayView.swift): `Sources/Public/View Protocols/Public+DayView.swift`
- [Weekday Label](https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BWeekdayLabel.swift): `Sources/Public/View Protocols/Public+WeekdayLabel.swift`
- [Month Label](https://github.com/mijick/calendarview/blob/main/Sources/Public/View%20Protocols/Public%2BMonthLabel.swift): `Sources/Public/View Protocols/Public+MonthLabel.swift`
- [Calendar Config](https://github.com/mijick/calendarview/blob/main/Sources/Public/Configurables/Public%2BCalendarConfig.swift): `Sources/Public/Configurables/Public+CalendarConfig.swift`

### Other components

- **App**

## Connections

- App → Calendar Initializer: creates
- Calendar Initializer → Calendar View: initializes
- Calendar Initializer → Calendar Config: configures
- Calendar View → Month Grid Data: generates
- Month Grid Data → Calendar Settings: reads settings
- Calendar View → Selection State: initializes
- Calendar View → Month Renderer: renders months
- Calendar View → Weekday Header: renders header
- Calendar View → Month Label: creates labels
- Calendar Config → Weekday Header: selects view
- Month Renderer → Day View Protocol: renders cells
- Day View Protocol → Default Day View: provides defaults
- Day View Protocol → Date Range: checks range
- Day View Protocol → Date Formatter: formats dates
- Month Grid Data → Date Helpers: calculates dates
- Date Helpers → Calendar Settings: uses settings
- Weekday Header → Weekday Label: renders labels
- Weekday Label → Weekday Symbols: uses symbols
