Skip to content

cocoar-dev/Cocoar.Calendar.iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cocoar Calendar — iOS

SwiftUI port of @cocoar/vue-calendarbehavior-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.

Features

  • Views: day, week, work week, month, agenda — one CalendarShell with 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; canDrop veto 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 / .dark presets (~30 tokens, all mutable), adaptive via .calendarTheme(light:dark:). The dark values ship upstream as tokens-dark.css since 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 Calendar in the date math, fully deterministic. Event end is exclusive everywhere (RFC 5545).
  • SwiftUI-pure: no UIKit import; the package compiles for iOS and macOS.

Requirements

  • iOS 26+ / macOS 26+
  • Swift 6.0+

Installation (Swift Package Manager)

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.

Quick start

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).

Demo app

cd demo && xcodegen generate
xcodebuild -project CocoarCalendarDemo.xcodeproj -scheme CocoarCalendarDemo \
  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build

Launch argument -demoView Woche|Monat|Agenda|Tag|Arbeitswoche selects the start view (scriptable screenshots).

Behavioral parity

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.

License

Apache-2.0 © COCOAR e.U. — same license and copyright holder as the upstream Coar Design System.

About

SwiftUI port of @cocoar/vue-calendar — behavior-identical to the web (fixture-verified), iOS 26+/macOS 26+

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors