본문 바로가기
@capgo/capacitor-calendar Device API 오픈 소스

캘린더 Capacitor 플러그인

iOS 및 Android에서 네이티브 캘린더 이벤트를 관리하고, iOS Reminders도 지원합니다

설치

bun add @capgo/capacitor-calendar bunx cap sync
npm, pnpm 또는 yarn
  • npm install @capgo/capacitor-calendar
  • pnpm add @capgo/capacitor-calendar
  • yarn add @capgo/capacitor-calendar

데모

캘린더 데모

iOS와 Android의 네이티브 캘린더 이벤트 생성 데모를 애니메이션 WebP로 내보냈습니다.

소스 에셋
iOS 네이티브 캘린더 이벤트 생성 데모
iOS 이벤트 생성
Android 네이티브 캘린더 이벤트 생성 데모
Android 이벤트 생성

가이드

Capacitor에서 Calendar 사용법

기기에서 테스트하기

Capgo 앱을 다운로드한 후 QR code을 스캔하세요.

Calendar 플러그인 미리보기 QR code

@capgo/capacitor-calendar 사용하기

이 @capgo/capacitor-calendar Capacitor 앱에서 이 패키지를 사용하면 iOS와 Android의 네이티브 캘린더 이벤트를 관리할 수 있습니다. 캘린더 권한 요청, 이벤트 생성 및 수정, 네이티브 캘린더 UI 열기, 캘린더와 이벤트 목록 조회, iOS의 Reminders 관리까지 지원합니다.

설치

npm install @capgo/capacitor-calendar
npx cap sync

네이티브 권한 설정

iOS에서는 앱에 필요한 사용 설명(usage description)을 다음 파일에 추가하세요: ios/App/App/Info.plist:

<key>NSCalendarsUsageDescription</key>
<string>This app needs calendar access.</string>
<key>NSCalendarsWriteOnlyAccessUsageDescription</key>
<string>This app needs permission to add calendar events.</string>
<key>NSCalendarsFullAccessUsageDescription</key>
<string>This app needs permission to read and manage calendar events.</string>
<key>NSRemindersFullAccessUsageDescription</key>
<string>This app needs permission to read and manage reminders.</string>

Android에서는 앱에 필요한 캘린더 권한을 다음 파일에 추가하세요: android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

권한 요청

import { CapacitorCalendar } from '@capgo/capacitor-calendar';

const permission = await CapacitorCalendar.requestFullCalendarAccess();

if (permission.result !== 'granted') {
  throw new Error('Calendar permission was not granted');
}

이벤트 생성

const startDate = Date.now() + 60 * 60 * 1000;
const endDate = startDate + 60 * 60 * 1000;

const { id } = await CapacitorCalendar.createEvent({
  title: 'Product review',
  location: 'Capgo',
  startDate,
  endDate,
  description: 'Created with @capgo/capacitor-calendar',
});

console.log('Created event', id);

네이티브 이벤트 UI 열기

await CapacitorCalendar.createEventWithPrompt({
  title: 'Planning session',
  location: 'Office',
  startDate: Date.now() + 24 * 60 * 60 * 1000,
  endDate: Date.now() + 25 * 60 * 60 * 1000,
});

이벤트 목록

const now = Date.now();

const { result: events } = await CapacitorCalendar.listEventsInRange({
  from: now,
  to: now + 7 * 24 * 60 * 60 * 1000,
});

iOS 미리 알림

const permission = await CapacitorCalendar.requestFullRemindersAccess();

if (permission.result === 'granted') {
  await CapacitorCalendar.createReminder({
    title: 'Send launch notes',
    dueDate: Date.now() + 2 * 24 * 60 * 60 * 1000,
  });
}

Reminders 기능은 iOS에서만 사용할 수 있습니다.

전체 레퍼런스

자주 묻는 질문

Calendar 플러그인 FAQ

Capacitor 앱에 Calendar 플러그인을 어떻게 설치하나요?

"bun add @capgo/capacitor-calendar"(또는 "npm install @capgo/capacitor-calendar")를 실행한 다음 "bunx cap sync"를 실행해 iOS와 Android 프로젝트에 네이티브 code가 반영되도록 하세요. 그다음 앱 code에서 "@capgo/capacitor-calendar"를 import하세요.

@capgo/capacitor-calendar가 React, Vue, Angular와 호환되나요?

네. Calendar는 Capacitor 패키지이므로 Ionic, React, Vue, Angular, Svelte 및 일반 JavaScript를 포함해 Capacitor에서 실행되는 모든 웹 프레임워크와 호환됩니다.

@capgo/capacitor-calendar은 어떤 Capacitor 버전을 지원하나요?

Capgo 플러그인은 Capacitor의 메이저 버전을 따릅니다. 사용 중인 Capacitor 메이저 버전과 일치하는 플러그인 메이저 버전을 사용하세요 (예: Capacitor 8에는 플러그인 v8). 유지 관리되는 버전은 GitHub README의 호환성 표에서 확인할 수 있습니다.

@capgo/capacitor-calendar는 무료 오픈 소스인가요?

네. code의 소스 코드는 GitHub의 https://github.com/Cap-go/capacitor-calendar/에서 공개되어 있고, 패키지는 npm에서 무료로 설치할 수 있습니다. 버그 리포트와 pull request를 환영합니다.

App Store 심사 없이 Calendar를 사용하는 code를 업데이트할 수 있나요?

플러그인을 설치하거나 업그레이드하면 네이티브 code가 변경되므로 새로운 스토어 빌드가 필요합니다. 그 이후에는 플러그인을 호출하는 JavaScript, HTML, CSS 변경 사항을 Capgo live updates로 즉시 배포할 수 있습니다.

앱 심사 대기 없이 Calendar 변경 사항을 즉시 배포하세요

스토어 빌드에 플러그인이 포함되면, Capgo live updates로 JavaScript, HTML, CSS 변경 사항을 몇 분 만에 사용자에게 푸시할 수 있습니다.

Capgo로 시작하기