loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / PLOTTING AND CALENDARS

MonthlyCalendar

A date-only monthly grid with caller-owned event, today, and selection styling.

Seven three-cell columns make a 21-cell grid. Narrow viewports clip whole glyphs without changing date geometry. Weekday labels use Monday-first array order and are rotated according to firstWeekday. Names are caller-localizable; the widget never reads the wall clock or changes terminal modes.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Example

_ = MonthlyCalendar(month: try CalendarMonth(year: 2026, month: 10))
Members on this page

Feature guides and release status

MonthlyCalendar

Structure
struct MonthlyCalendar

Conforms to: Swift.Sendable, Swift.SendableMetatype, Widget.

A date-only monthly grid with caller-owned event, today, and selection styling.

Seven three-cell columns make a 21-cell grid. Narrow viewports clip whole glyphs without changing date geometry. Weekday labels use Monday-first array order and are rotated according to firstWeekday. Names are caller-localizable; the widget never reads the wall clock or changes terminal modes.

Source · MonthlyCalendar.swift:7

month

Instance Property
var month: CalendarMonth

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:8

firstWeekday

Instance Property
var firstWeekday: CalendarWeekday

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:9

showsMonthHeader

Instance Property
var showsMonthHeader: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:10

showsWeekdays

Instance Property
var showsWeekdays: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:11

showsSurroundingDays

Instance Property
var showsSurroundingDays: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:12

fixedWeekCount

Instance Property
var fixedWeekCount: Bool

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:13

monthNames

Instance Property
var monthNames: [String]

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:14

weekdayLabels

Instance Property
var weekdayLabels: [String]

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:18

style

Instance Property
var style: Style

Visual attributes used when painting this value.

Source · MonthlyCalendar.swift:19

headerStyle

Instance Property
var headerStyle: Style

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:20

weekdayStyle

Instance Property
var weekdayStyle: Style

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:21

weekendPatch

Instance Property
var weekendPatch: StylePatch

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:22

surroundingPatch

Instance Property
var surroundingPatch: StylePatch

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:23

events

Instance Property
var events: [CalendarDay : StylePatch]

Asynchronous throwing stream of InputEvent batches, consumed on the main actor.

Source · MonthlyCalendar.swift:24

today

Instance Property
var today: CalendarDay?

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:25

todayPatch

Instance Property
var todayPatch: StylePatch

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:26

selectedDay

Instance Property
var selectedDay: CalendarDay?

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:27

selectionPatch

Instance Property
var selectionPatch: StylePatch

A public field of this type. Its value type and mutability are shown in the declaration.

Source · MonthlyCalendar.swift:28

init(month:events:)

Initializer
init(month: CalendarMonth, events: [CalendarDay : StylePatch] = [:])

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (2)
month
Argument type and any default are shown in the declaration; see the behavior notes above.
events
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · MonthlyCalendar.swift:30

requiredHeight

Instance Property
var requiredHeight: Int { get }

Number of rows needed for all enabled headers and weeks, before clipping.

Source · MonthlyCalendar.swift:36

date(at:in:)

Instance Method
func date(at point: Point, in area: Rect) -> CalendarDay?

Maps a visible day label to its date.

Separators, headers, and hidden surrounding days have no target.

Parameters (2)
at
Argument type and any default are shown in the declaration; see the behavior notes above.
in
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns CalendarDay?.

Source · MonthlyCalendar.swift:41

render(in:buffer:)

Instance Method
func render(in area: Rect, buffer: inout Buffer)

Paints this widget into the assigned terminal-cell rectangle. Application code owns state, input routing, and terminal lifetime.

Parameters (2)
in
Argument type and any default are shown in the declaration; see the behavior notes above.
buffer
Mutable destination cell grid.
Source · MonthlyCalendar.swift:53