SwiftUI port of
@cocoar/vue-calendar— behavior-identical to the web. The TypeScript sources are the specification, not inspiration: the core logic is verified bit-for-bit against fixtures generated by the real Vue implementation.
- Views: day, week, work week, month, agenda — one
CalendarShellwith toolbar (‹ today ›, range label, view switcher), or each view standalone. - Drag & drop: long-press lift, move + resize in the time grid, month grid and all-day band; preview == commit through one shared drop pipeline;
canDropveto with invalid-ghost + snap-back. - Gestures: tap / double-tap / long-press hooks on day cells and time slots (the app picks the semantics), swipe paging in the month view.
- Theming:
CalendarTheme.light/.darkpresets (~30 tokens, all mutable), adaptive via.calendarTheme(light:dark:). The dark values ship upstream astokens-dark.csssince 2.15.0 — web and iOS stay literal-for-literal comparable. - Own time kernel: zone-aware civil date/time types with an explicit DST resolver — no Foundation
Calendarin the date math, fully deterministic. Eventendis exclusive everywhere (RFC 5545). - SwiftUI-pure: no UIKit import; the package compiles for iOS and macOS.
- iOS 26+ / macOS 26+
- Swift 6.0+
dependencies: [
.package(url: "https://github.com/cocoar-dev/Cocoar.Calendar.iOS", branch: "develop"),
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "CocoarCalendarUI", package: "Cocoar.Calendar.iOS"),
]),
]CocoarCalendarCore (pure logic, no SwiftUI) is available as a separate product.
import CocoarCalendarUI
let controller = CalendarController<BasicEventMeta>(
view: .week,
timezone: TimeZone.current.identifier,
firstDayOfWeek: 1, // 0 = Sunday … 6 = Saturday
timeRange: (startHour: 7, endHour: 20)
)
controller.setEvents(events)
controller.onEventClick = { event in /* … */ }
controller.onTimeLongPress = { date, time in /* create here */ }
var body: some View {
CalendarShell(controller: controller)
.calendarTheme(light: .light, dark: .dark)
}The full walkthrough — event loader, drag & drop wiring, all gesture hooks, localized labels, theming — lives in docs/integration-guide.md (German).
cd demo && xcodegen generate
xcodebuild -project CocoarCalendarDemo.xcodeproj -scheme CocoarCalendarDemo \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' buildLaunch argument -demoView Woche|Monat|Agenda|Tag|Arbeitswoche selects the start view (scriptable screenshots).
Tests/…/Fixtures/*.json are generated from the actual Vue implementation (tools/gen-fixtures*.ts) and are the behavioral contract — never edit them by hand. swift test replays them against the Swift port (368 tests). Analysis of the ported spec: docs/vue-calendar-analyse.md.
Apache-2.0 © COCOAR e.U. — same license and copyright holder as the upstream Coar Design System.