This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
TimelineUI is a SwiftUI component library for displaying calendar timeline visualizations. It provides day view timelines with hour grids and event blocks, suitable for showing schedules and detecting conflicts.
mise run build # Build the Swift package
mise run tests # Run package unit tests
mise run format # Format Swift source files
mise run previews # Generate preview PNG images to ./previews/
mise run clean # Clean build artifacts- Package.swift - Swift Package at root containing the library
- Sources/TimelineUI/ - Core library with timeline components
TimelineItem.swift- View model for timeline eventsDayTimelineView.swift- Full day timeline with hour gridCompactTimelineView.swift- Compact 2-3 hour previewTimelineEventBlock.swift- Individual event block componentAccessRestrictedModifier.swift- Blur+overlay for restricted contentAccessPromptView.swift- Standard UI for requesting access
- Sources/TimelineUIEventKit/ - Optional EventKit integration
EKEvent+TimelineItem.swift- Convert EKEvent to TimelineItem
- Sources/RenderPreviews/ - macOS CLI to generate preview PNGs
- Tests/TimelineUITests/ - Unit tests for the library
- Target: iOS 26+, macOS 14+
- Swift 6.2 with modern concurrency
- SwiftUI only - no UIKit dependencies in core library
- TimelineUIEventKit links EventKit framework
The library uses a simple TimelineItem struct as the view model:
TimelineItem(
title: String,
startDate: Date,
endDate: Date,
isAllDay: Bool = false,
color: Color,
location: String? = nil,
isPrimary: Bool = false // Distinguishes "new" from "existing" events
)Views accept [TimelineItem] arrays and handle layout automatically.
For permission-restricted content (e.g., calendar access), use the blur+overlay modifier:
CompactTimelineView(items: items)
.accessRestricted(!canReadEvents) {
AccessPromptView.calendar(style: .compact) {
await requestAccess()
}
}Import TimelineUIEventKit for EKEvent conversion:
import TimelineUIEventKit
let item = TimelineItem(ekEvent)
let items = ekEvents.asTimelineItems(primaryEventID: selectedEvent.eventIdentifier)- Use Swift Testing framework with raw identifiers for test names:
@Test func `renders items with correct positions`() throws { ... }
- Do not add comments unless asked
- After modifying UI components, run
mise run previewsto regenerate preview images