├── .nvmrc ├── .watchmanconfig ├── example ├── .watchmanconfig ├── .husky │ ├── commit-msg │ └── pre-commit ├── src │ ├── navigation │ │ ├── index.ts │ │ └── RootNavigator.tsx │ └── screens │ │ ├── index.ts │ │ ├── HomeScreen.tsx │ │ └── PermissionScreen.tsx ├── jest.config.js ├── app.json ├── .bundle │ └── config ├── tsconfig.json ├── .eslintrc.js ├── babel.config.js ├── commitlint.config.js ├── android │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── drawable │ │ │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ ├── MainActivity.kt │ │ │ │ │ │ └── MainApplication.kt │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ └── AndroidManifest.xml │ │ ├── debug.keystore │ │ └── proguard-rules.pro │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── gradle.properties │ └── gradlew.bat ├── ios │ ├── example │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── PrivacyInfo.xcprivacy │ │ └── Info.plist │ ├── example.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── .xcode.env │ ├── Podfile │ └── example.xcodeproj │ │ └── xcshareddata │ │ └── xcschemes │ │ └── example.xcscheme ├── .prettierrc.js ├── index.js ├── react-native.config.js ├── Gemfile ├── App.tsx ├── .gitignore ├── metro.config.js ├── package.json ├── Gemfile.lock └── README.md ├── .husky ├── commit-msg └── pre-commit ├── nitrogen └── generated │ ├── .gitattributes │ ├── ios │ ├── c++ │ │ ├── HybridEventKitSpecSwift.cpp │ │ ├── HybridCalendarPermissionSpecSwift.cpp │ │ └── HybridCalendarPermissionSpecSwift.hpp │ ├── swift │ │ ├── EventKitPredicate.swift │ │ ├── EventKitEntityType.swift │ │ ├── EventKitCoordinate.swift │ │ ├── EventKitStatus.swift │ │ ├── Func_void.swift │ │ ├── EventKitParticipantType.swift │ │ ├── EventKitAvailability.swift │ │ ├── EventKitCalendarType.swift │ │ ├── EventKitParticipantRole.swift │ │ ├── Func_void_bool.swift │ │ ├── EventKitSourceType.swift │ │ ├── Func_void_EventKitEvent.swift │ │ ├── EventKitPermissionResult.swift │ │ ├── Func_void_EventKitCalendar.swift │ │ ├── Func_void_std__exception_ptr.swift │ │ ├── Func_void_std__vector_EventKitEvent_.swift │ │ ├── Func_void_EventKitPermissionResult.swift │ │ ├── Func_void_std__vector_EventKitCalendar_.swift │ │ ├── EventKitParticipantStatus.swift │ │ ├── HybridCalendarPermissionSpec.swift │ │ ├── MonthlyEventOptions.swift │ │ ├── EventKitEntityMask.swift │ │ ├── CreateEventLocation.swift │ │ ├── HybridEventKitSpec.swift │ │ ├── EventKitSource.swift │ │ ├── RangeEventOptions.swift │ │ ├── EventKitStructuredLocation.swift │ │ ├── CreateCalendarOptions.swift │ │ ├── EditEventLocation.swift │ │ ├── EventKitParticipant.swift │ │ ├── EventKitGeoLocation.swift │ │ └── EventKitCalendarEventAvailabilityMask.swift │ ├── NitroEventKitAutolinking.mm │ ├── NitroEventKitAutolinking.swift │ └── NitroEventKit+autolinking.rb │ └── shared │ └── c++ │ ├── HybridCalendarPermissionSpec.cpp │ ├── HybridEventKitSpec.cpp │ ├── HybridCalendarPermissionSpec.hpp │ ├── EventKitEntityType.hpp │ ├── EventKitStatus.hpp │ ├── EventKitPredicate.hpp │ ├── EventKitCalendarType.hpp │ ├── EventKitAvailability.hpp │ ├── EventKitParticipantType.hpp │ ├── EventKitSourceType.hpp │ ├── EventKitParticipantRole.hpp │ ├── EventKitParticipantStatus.hpp │ ├── EventKitCoordinate.hpp │ ├── EventKitEntityMask.hpp │ ├── MonthlyEventOptions.hpp │ ├── CreateEventLocation.hpp │ ├── EditEventLocation.hpp │ ├── EventKitStructuredLocation.hpp │ ├── RangeEventOptions.hpp │ ├── EventKitSource.hpp │ ├── EventKitCalendarEventAvailabilityMask.hpp │ ├── HybridEventKitSpec.hpp │ └── CreateCalendarOptions.hpp ├── .yarnrc.yml ├── babel.config.js ├── commitlint.config.js ├── ios ├── Bridge.h ├── Double+Extension.swift ├── UIApplication+Extension.swift ├── Date+Extension.swift ├── EventKitManager.swift ├── EventDetailLabel.swift ├── CloseButton.swift ├── EventKitError.swift ├── UIColor+Extension.swift ├── HybridCalendarPermission.swift └── PreviewCalendarInforView.swift ├── .prettierrc.js ├── src ├── specs │ ├── CalendarPermission.nitro.ts │ └── EventKit.nitro.ts └── index.ts ├── react-native.config.js ├── nitro.json ├── tsconfig.json ├── License.md ├── .gitignore ├── NitroEventKit.podspec └── .github └── workflows └── publish.yml /.nvmrc: -------------------------------------------------------------------------------- 1 | 22.13.0 2 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | npx commitlint --edit $1 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | yarn run lint && yarn run typescript 2 | -------------------------------------------------------------------------------- /example/.husky/commit-msg: -------------------------------------------------------------------------------- 1 | npx commitlint --edit $1 2 | -------------------------------------------------------------------------------- /nitrogen/generated/.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-generated 2 | -------------------------------------------------------------------------------- /example/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | yarn run lint && yarn run typescript 2 | -------------------------------------------------------------------------------- /example/src/navigation/index.ts: -------------------------------------------------------------------------------- 1 | export * from './RootNavigator'; 2 | -------------------------------------------------------------------------------- /example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | yarnPath: .yarn/releases/yarn-4.10.3.cjs 3 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "displayName": "example" 4 | } 5 | -------------------------------------------------------------------------------- /example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | } 4 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@react-native/typescript-config/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'], 3 | } 4 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native', 4 | }; 5 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | example 3 | 4 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/Bridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bridge.h 3 | // NitroEventKit 4 | // 5 | // Created by Marc Rousavy on 22.07.24. 6 | // 7 | 8 | #pragma once 9 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/debug.keystore -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: true, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | } 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: true, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VladyslavMartynov10/react-native-nitro-event-kit/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import { AppRegistry } from 'react-native'; 6 | import { App } from './App'; 7 | import { name as appName } from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /example/src/screens/index.ts: -------------------------------------------------------------------------------- 1 | export * from './HomeScreen'; 2 | export * from './PermissionScreen'; 3 | export * from './EventScreen'; 4 | export * from './CalendarScreen'; 5 | export * from './CreateEventScreen'; 6 | export * from './ManageEventScreen'; 7 | -------------------------------------------------------------------------------- /ios/Double+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Double+Extension.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 15.02.2025. 6 | // 7 | 8 | import Foundation 9 | 10 | 11 | extension Double { 12 | var asDateFromMilliseconds: Date { 13 | Date(timeIntervalSince1970: self / 1000) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/react-native.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | dependencies: { 6 | [pak.name]: { 7 | root: path.join(__dirname, '..'), 8 | }, 9 | }, 10 | project: { 11 | ios: { 12 | automaticPodsInstallation: true, 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /src/specs/CalendarPermission.nitro.ts: -------------------------------------------------------------------------------- 1 | import { type HybridObject } from 'react-native-nitro-modules' 2 | import type { EventKitPermissionResult } from './types' 3 | 4 | export interface CalendarPermission extends HybridObject<{ ios: 'swift' }> { 5 | getPermissionsStatus(): EventKitPermissionResult 6 | requestPermission(): Promise 7 | } 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } 2 | plugins { id("com.facebook.react.settings") } 3 | extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } 4 | rootProject.name = 'example' 5 | include ':app' 6 | includeBuild('../node_modules/@react-native/gradle-plugin') 7 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/c++/HybridEventKitSpecSwift.cpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridEventKitSpecSwift.cpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #include "HybridEventKitSpecSwift.hpp" 9 | 10 | namespace margelo::nitro::eventkit { 11 | } // namespace margelo::nitro::eventkit 12 | -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | 6 | # Exclude problematic versions of cocoapods and activesupport that causes build failures. 7 | gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1' 8 | gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0' 9 | gem 'xcodeproj', '< 1.26.0' 10 | gem 'concurrent-ruby', '< 1.3.4' 11 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/c++/HybridCalendarPermissionSpecSwift.cpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridCalendarPermissionSpecSwift.cpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #include "HybridCalendarPermissionSpecSwift.hpp" 9 | 10 | namespace margelo::nitro::eventkit { 11 | } // namespace margelo::nitro::eventkit 12 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | // https://github.com/react-native-community/cli/blob/main/docs/dependencies.md 2 | 3 | module.exports = { 4 | dependency: { 5 | platforms: { 6 | /** 7 | * @type {import('@react-native-community/cli-types').IOSDependencyParams} 8 | */ 9 | ios: {}, 10 | /** 11 | * @type {import('@react-native-community/cli-types').AndroidDependencyParams} 12 | */ 13 | android: {}, 14 | }, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { NitroModules } from 'react-native-nitro-modules' 2 | 3 | import type { EventKit } from './specs/EventKit.nitro' 4 | import type { CalendarPermission } from './specs/CalendarPermission.nitro' 5 | 6 | export const NitroEventKit = 7 | NitroModules.createHybridObject('EventKit') 8 | 9 | export const NitroEventKitCalendarPermission = 10 | NitroModules.createHybridObject('CalendarPermission') 11 | 12 | export * from './specs/types' 13 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /nitro.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://nitro.margelo.com/nitro.schema.json", 3 | "cxxNamespace": ["eventkit"], 4 | "ios": { 5 | "iosModuleName": "NitroEventKit" 6 | }, 7 | "android": { 8 | "androidNamespace": ["eventkit"], 9 | "androidCxxLibName": "NitroEventKit" 10 | }, 11 | "autolinking": { 12 | "EventKit": { 13 | "swift": "HybridEventKit" 14 | }, 15 | "CalendarPermission": { 16 | "swift": "HybridCalendarPermission" 17 | } 18 | }, 19 | "ignorePaths": ["**/node_modules"] 20 | } 21 | -------------------------------------------------------------------------------- /example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /example/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { GestureHandlerRootView } from 'react-native-gesture-handler'; 4 | import { SafeAreaProvider } from 'react-native-safe-area-context'; 5 | import { RootNavigator } from './src/navigation'; 6 | 7 | export const App: React.FC = () => ( 8 | 9 | 10 | 11 | 12 | 13 | ); 14 | 15 | const styles = StyleSheet.create({ 16 | layout: { 17 | flex: 1, 18 | }, 19 | }); 20 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | buildToolsVersion = "35.0.0" 4 | minSdkVersion = 24 5 | compileSdkVersion = 35 6 | targetSdkVersion = 34 7 | ndkVersion = "27.1.12297006" 8 | kotlinVersion = "2.0.21" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /ios/UIApplication+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+Extension.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 15.02.2025. 6 | // 7 | 8 | import Foundation 9 | 10 | import UIKit 11 | 12 | extension UIApplication { 13 | var rootViewController: UIViewController? { 14 | guard let rootVc = connectedScenes 15 | .compactMap({ $0 as? UIWindowScene }) 16 | .flatMap(\.windows) 17 | .first(where: { $0.isKeyWindow })? 18 | .rootViewController else { return nil } 19 | 20 | var activeController = rootVc 21 | 22 | while let presentedViewController = activeController.presentedViewController { 23 | activeController = presentedViewController 24 | } 25 | 26 | return activeController 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "allowUnreachableCode": false, 5 | "allowUnusedLabels": false, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "jsx": "react", 9 | "lib": ["esnext"], 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "noEmit": false, 13 | "noFallthroughCasesInSwitch": true, 14 | "noImplicitReturns": true, 15 | "noImplicitUseStrict": false, 16 | "noStrictGenericChecks": false, 17 | "noUncheckedIndexedAccess": true, 18 | "noUnusedLocals": true, 19 | "noUnusedParameters": true, 20 | "resolveJsonModule": true, 21 | "skipLibCheck": true, 22 | "strict": true, 23 | "target": "esnext", 24 | "verbatimModuleSyntax": true 25 | }, 26 | "include": ["src/**/*"], 27 | "exclude": ["example", "lib", "node_modules"] 28 | } 29 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/HybridCalendarPermissionSpec.cpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridCalendarPermissionSpec.cpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #include "HybridCalendarPermissionSpec.hpp" 9 | 10 | namespace margelo::nitro::eventkit { 11 | 12 | void HybridCalendarPermissionSpec::loadHybridMethods() { 13 | // load base methods/properties 14 | HybridObject::loadHybridMethods(); 15 | // load custom methods/properties 16 | registerHybrids(this, [](Prototype& prototype) { 17 | prototype.registerHybridMethod("getPermissionsStatus", &HybridCalendarPermissionSpec::getPermissionsStatus); 18 | prototype.registerHybridMethod("requestPermission", &HybridCalendarPermissionSpec::requestPermission); 19 | }); 20 | } 21 | 22 | } // namespace margelo::nitro::eventkit 23 | -------------------------------------------------------------------------------- /ios/Date+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+Extension.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 15.02.2025. 6 | // 7 | 8 | import Foundation 9 | 10 | extension Date { 11 | var unixTimestampInMilliseconds: Double { 12 | self.timeIntervalSince1970 * 1000 13 | } 14 | 15 | func formattedString(format: String) -> String { 16 | let formatter = DateFormatter() 17 | formatter.dateFormat = format 18 | return formatter.string(from: self) 19 | } 20 | 21 | func eventFormattedText(to endDate: Date) -> String { 22 | let formattedDate = self.formattedString(format: "EEEE, d MMM yyyy") 23 | let formattedStartTime = self.formattedString(format: "h:mm a") 24 | let formattedEndTime = endDate.formattedString(format: "h:mm a") 25 | 26 | return "\(formattedDate)\nfrom \(formattedStartTime) to \(formattedEndTime)" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ios/EventKitManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventKitManager.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 04.02.2025. 6 | // 7 | 8 | import Foundation 9 | import EventKit 10 | 11 | final class EventKitManager { 12 | static let shared = EventKitManager() 13 | 14 | let eventStore = EKEventStore() 15 | 16 | private(set) var isCalendarAccessAvailable: Bool 17 | 18 | private init() { 19 | self.isCalendarAccessAvailable = Self.checkAuthorizationStatus() 20 | } 21 | 22 | private static func checkAuthorizationStatus() -> Bool { 23 | let status = EKEventStore.authorizationStatus(for: .event) 24 | 25 | if #available(iOS 17.0, *) { 26 | return status == .fullAccess 27 | } else { 28 | return status == .authorized 29 | } 30 | } 31 | 32 | func updateCalendarAccessStatus() { 33 | self.isCalendarAccessAvailable = Self.checkAuthorizationStatus() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import com.facebook.react.ReactActivity 4 | import com.facebook.react.ReactActivityDelegate 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate 7 | 8 | class MainActivity : ReactActivity() { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | override fun getMainComponentName(): String = "example" 15 | 16 | /** 17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 19 | */ 20 | override fun createReactActivityDelegate(): ReactActivityDelegate = 21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 22 | } 23 | -------------------------------------------------------------------------------- /ios/EventDetailLabel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventDetailLabel.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 16.02.2025. 6 | // 7 | 8 | import UIKit 9 | 10 | class EventDetailLabel: UILabel { 11 | override init(frame: CGRect) { 12 | super.init(frame: frame) 13 | configure() 14 | } 15 | 16 | required init?(coder: NSCoder) { 17 | fatalError("init(coder:) has not been implemented") 18 | } 19 | 20 | init(text: String, font: UIFont = .systemFont(ofSize: 16), textColor: UIColor = .gray, alignment: NSTextAlignment = .left, numberOfLines: Int = 1) { 21 | super.init(frame: .zero) 22 | 23 | self.text = text 24 | self.font = font 25 | self.textColor = textColor 26 | self.textAlignment = alignment 27 | self.numberOfLines = numberOfLines 28 | 29 | configure() 30 | } 31 | 32 | private func configure() { 33 | self.translatesAutoresizingMaskIntoConstraints = false 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitPredicate.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitPredicate.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitPredicate`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitPredicate = margelo.nitro.eventkit.EventKitPredicate 14 | 15 | public extension EventKitPredicate { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitPredicate`. 20 | */ 21 | init(predicateFormat: String) { 22 | self.init(std.string(predicateFormat)) 23 | } 24 | 25 | var predicateFormat: String { 26 | @inline(__always) 27 | get { 28 | return String(self.__predicateFormat) 29 | } 30 | @inline(__always) 31 | set { 32 | self.__predicateFormat = std.string(newValue) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/specs/EventKit.nitro.ts: -------------------------------------------------------------------------------- 1 | import { type HybridObject } from 'react-native-nitro-modules' 2 | import type { 3 | CreateCalendarOptions, 4 | CreateEventOptions, 5 | EditEventOptions, 6 | EventKitCalendar, 7 | EventKitEvent, 8 | MonthlyEventOptions, 9 | RangeEventOptions, 10 | } from './types' 11 | 12 | export interface EventKit extends HybridObject<{ ios: 'swift' }> { 13 | getActiveCalendars(): Promise 14 | getMonthlyCalendarEvents( 15 | options: MonthlyEventOptions 16 | ): Promise 17 | getCalendarEventsByRange(options: RangeEventOptions): Promise 18 | createEvent(options: CreateEventOptions): Promise 19 | deleteEvent(eventIdentifier: string): Promise 20 | openCalendarEvent(eventIdentifier: string): Promise 21 | createCalendar(options: CreateCalendarOptions): Promise 22 | editEvent( 23 | eventIdentifier: string, 24 | options: EditEventOptions 25 | ): Promise 26 | } 27 | -------------------------------------------------------------------------------- /ios/CloseButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CloseButton.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 16.02.2025. 6 | // 7 | 8 | import UIKit 9 | 10 | class CloseButton: UIButton { 11 | 12 | override init(frame: CGRect) { 13 | super.init(frame: frame) 14 | configure(with: "Done") 15 | } 16 | 17 | init(title: String, target: Any?, action: Selector) { 18 | super.init(frame: .zero) 19 | 20 | configure(with: title) 21 | 22 | addTarget(target, action: action, for: .touchUpInside) 23 | } 24 | 25 | required init?(coder: NSCoder) { 26 | fatalError("init(coder:) has not been implemented") 27 | } 28 | 29 | private func configure(with title: String) { 30 | setTitle(title, for: .normal) 31 | setTitleColor(.systemBlue, for: .normal) 32 | titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) 33 | backgroundColor = .clear 34 | translatesAutoresizingMaskIntoConstraints = false 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /example/src/navigation/RootNavigator.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { NavigationContainer } from '@react-navigation/native'; 3 | import { createNativeStackNavigator } from '@react-navigation/native-stack'; 4 | import { 5 | CalendarScreen, 6 | CreateEventScreen, 7 | EventsScreen, 8 | HomeScreen, 9 | ManageEventScreen, 10 | PermissionScreen, 11 | } from '../screens'; 12 | 13 | export const Stack = createNativeStackNavigator(); 14 | 15 | export const RootNavigator: React.FC = () => { 16 | return ( 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ); 28 | }; 29 | -------------------------------------------------------------------------------- /example/ios/example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import React 3 | import React_RCTAppDelegate 4 | import ReactAppDependencyProvider 5 | 6 | @main 7 | class AppDelegate: RCTAppDelegate { 8 | override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 9 | self.moduleName = "example" 10 | self.dependencyProvider = RCTAppDependencyProvider() 11 | 12 | // You can add your custom initial props in the dictionary below. 13 | // They will be passed down to the ViewController used by React Native. 14 | self.initialProps = [:] 15 | 16 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 17 | } 18 | 19 | override func sourceURL(for bridge: RCTBridge) -> URL? { 20 | self.bundleURL() 21 | } 22 | 23 | override func bundleURL() -> URL? { 24 | #if DEBUG 25 | RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") 26 | #else 27 | Bundle.main.url(forResource: "main", withExtension: "jsbundle") 28 | #endif 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitEntityType.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitEntityType.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitEntityType`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitEntityType = margelo.nitro.eventkit.EventKitEntityType 12 | 13 | public extension EventKitEntityType { 14 | /** 15 | * Get a EventKitEntityType for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Event": 21 | self = .event 22 | case "Reminder": 23 | self = .reminder 24 | default: 25 | return nil 26 | } 27 | } 28 | 29 | /** 30 | * Get the String value this EventKitEntityType represents. 31 | */ 32 | var stringValue: String { 33 | switch self { 34 | case .event: 35 | return "Event" 36 | case .reminder: 37 | return "Reminder" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2025 Vladyslav Martynov 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .classpath 35 | .cxx 36 | .gradle 37 | .idea 38 | .project 39 | .settings 40 | local.properties 41 | android.iml 42 | 43 | # Cocoapods 44 | # 45 | example/ios/Pods 46 | 47 | # Ruby 48 | example/vendor/ 49 | 50 | # node.js 51 | # 52 | node_modules/ 53 | npm-debug.log 54 | yarn-debug.log 55 | yarn-error.log 56 | 57 | # BUCK 58 | buck-out/ 59 | \.buckd/ 60 | android/app/libs 61 | android/keystores/debug.keystore 62 | 63 | # Yarn 64 | .yarn/* 65 | !.yarn/patches 66 | !.yarn/plugins 67 | !.yarn/releases 68 | !.yarn/sdks 69 | !.yarn/versions 70 | 71 | # Expo 72 | .expo/ 73 | 74 | # Turborepo 75 | .turbo/ 76 | 77 | # generated by bob 78 | lib/ 79 | 80 | # TypeScript 81 | tsconfig.tsbuildinfo 82 | -------------------------------------------------------------------------------- /example/ios/example/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyAccessedAPIType 9 | NSPrivacyAccessedAPICategoryFileTimestamp 10 | NSPrivacyAccessedAPITypeReasons 11 | 12 | C617.1 13 | 14 | 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryUserDefaults 18 | NSPrivacyAccessedAPITypeReasons 19 | 20 | CA92.1 21 | 22 | 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategorySystemBootTime 26 | NSPrivacyAccessedAPITypeReasons 27 | 28 | 35F9.1 29 | 30 | 31 | 32 | NSPrivacyCollectedDataTypes 33 | 34 | NSPrivacyTracking 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitCoordinate.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCoordinate.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitCoordinate`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitCoordinate = margelo.nitro.eventkit.EventKitCoordinate 14 | 15 | public extension EventKitCoordinate { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitCoordinate`. 20 | */ 21 | init(latitude: Double, longitude: Double) { 22 | self.init(latitude, longitude) 23 | } 24 | 25 | var latitude: Double { 26 | @inline(__always) 27 | get { 28 | return self.__latitude 29 | } 30 | @inline(__always) 31 | set { 32 | self.__latitude = newValue 33 | } 34 | } 35 | 36 | var longitude: Double { 37 | @inline(__always) 38 | get { 39 | return self.__longitude 40 | } 41 | @inline(__always) 42 | set { 43 | self.__longitude = newValue 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /NitroEventKit.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = "NitroEventKit" 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.homepage = package["homepage"] 10 | s.license = package["license"] 11 | s.authors = package["author"] 12 | 13 | s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 } 14 | s.source = { :git => "https://github.com/mrousavy/nitro.git", :tag => "#{s.version}" } 15 | 16 | s.source_files = [ 17 | # Implementation (Swift) 18 | "ios/**/*.{swift}", 19 | # Autolinking/Registration (Objective-C++) 20 | "ios/**/*.{m,mm}", 21 | # Implementation (C++ objects) 22 | "cpp/**/*.{hpp,cpp}", 23 | ] 24 | 25 | s.pod_target_xcconfig = { 26 | # C++ compiler flags, mainly for folly. 27 | "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES" 28 | } 29 | 30 | load 'nitrogen/generated/ios/NitroEventKit+autolinking.rb' 31 | add_nitrogen_files(s) 32 | 33 | s.dependency 'React-jsi' 34 | s.dependency 'React-callinvoker' 35 | install_modules_dependencies(s) 36 | end 37 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | linkage = ENV['USE_FRAMEWORKS'] 12 | if linkage != nil 13 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 14 | use_frameworks! :linkage => linkage.to_sym 15 | end 16 | 17 | target 'example' do 18 | config = use_native_modules! 19 | 20 | use_react_native!( 21 | :path => config[:reactNativePath], 22 | # An absolute path to your application root. 23 | :app_path => "#{Pod::Config.instance.installation_root}/..", 24 | :hermes_enabled => true, 25 | :fabric_enabled => true, 26 | :new_arch_enabled => true 27 | ) 28 | 29 | post_install do |installer| 30 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 31 | react_native_post_install( 32 | installer, 33 | config[:reactNativePath], 34 | :mac_catalyst_enabled => false, 35 | # :ccache_enabled => true 36 | ) 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitStatus.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitStatus.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitStatus`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitStatus = margelo.nitro.eventkit.EventKitStatus 12 | 13 | public extension EventKitStatus { 14 | /** 15 | * Get a EventKitStatus for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "None": 21 | self = .none 22 | case "Confirmed": 23 | self = .confirmed 24 | case "Tentative": 25 | self = .tentative 26 | case "Canceled": 27 | self = .canceled 28 | default: 29 | return nil 30 | } 31 | } 32 | 33 | /** 34 | * Get the String value this EventKitStatus represents. 35 | */ 36 | var stringValue: String { 37 | switch self { 38 | case .none: 39 | return "None" 40 | case .confirmed: 41 | return "Confirmed" 42 | case .tentative: 43 | return "Tentative" 44 | case .canceled: 45 | return "Canceled" 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: write 10 | issues: write 11 | pull-requests: write 12 | id-token: write 13 | 14 | jobs: 15 | release: 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: ⬇️ Checkout Repository 20 | uses: actions/checkout@v4 21 | 22 | - name: ⚙️ Enable Corepack and Use Correct Yarn Version 23 | run: | 24 | corepack enable 25 | corepack prepare yarn@4.10.3 --activate 26 | yarn --version 27 | 28 | - name: ⚙️ Set up Node.js 29 | uses: actions/setup-node@v4 30 | with: 31 | node-version-file: ".nvmrc" 32 | cache: "yarn" 33 | 34 | - name: 📦 Install Dependencies 35 | run: yarn install 36 | 37 | - name: 🛠 Build the Package 38 | run: yarn build 39 | 40 | - name: 🚀 Release to NPM and GitHub 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 43 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 44 | NPM_CONFIG_PROVENANCE: true 45 | GIT_AUTHOR_NAME: ${{ github.actor }} 46 | GIT_AUTHOR_EMAIL: "${{ github.actor }}@users.noreply.github.com" 47 | GIT_COMMITTER_NAME: ${{ github.actor }} 48 | GIT_COMMITTER_EMAIL: "${{ github.actor }}@users.noreply.github.com" 49 | run: yarn release 50 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | **/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | 65 | # testing 66 | /coverage 67 | 68 | # Yarn 69 | .yarn/* 70 | !.yarn/patches 71 | !.yarn/plugins 72 | !.yarn/releases 73 | !.yarn/sdks 74 | !.yarn/versions 75 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/HybridEventKitSpec.cpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridEventKitSpec.cpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #include "HybridEventKitSpec.hpp" 9 | 10 | namespace margelo::nitro::eventkit { 11 | 12 | void HybridEventKitSpec::loadHybridMethods() { 13 | // load base methods/properties 14 | HybridObject::loadHybridMethods(); 15 | // load custom methods/properties 16 | registerHybrids(this, [](Prototype& prototype) { 17 | prototype.registerHybridMethod("getActiveCalendars", &HybridEventKitSpec::getActiveCalendars); 18 | prototype.registerHybridMethod("getMonthlyCalendarEvents", &HybridEventKitSpec::getMonthlyCalendarEvents); 19 | prototype.registerHybridMethod("getCalendarEventsByRange", &HybridEventKitSpec::getCalendarEventsByRange); 20 | prototype.registerHybridMethod("createEvent", &HybridEventKitSpec::createEvent); 21 | prototype.registerHybridMethod("deleteEvent", &HybridEventKitSpec::deleteEvent); 22 | prototype.registerHybridMethod("openCalendarEvent", &HybridEventKitSpec::openCalendarEvent); 23 | prototype.registerHybridMethod("createCalendar", &HybridEventKitSpec::createCalendar); 24 | prototype.registerHybridMethod("editEvent", &HybridEventKitSpec::editEvent); 25 | }); 26 | } 27 | 28 | } // namespace margelo::nitro::eventkit 29 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/NitroEventKitAutolinking.mm: -------------------------------------------------------------------------------- 1 | /// 2 | /// NitroEventKitAutolinking.mm 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #import 9 | #import 10 | #import "NitroEventKit-Swift-Cxx-Umbrella.hpp" 11 | #import 12 | 13 | #include "HybridEventKitSpecSwift.hpp" 14 | #include "HybridCalendarPermissionSpecSwift.hpp" 15 | 16 | @interface NitroEventKitAutolinking : NSObject 17 | @end 18 | 19 | @implementation NitroEventKitAutolinking 20 | 21 | + (void) load { 22 | using namespace margelo::nitro; 23 | using namespace margelo::nitro::eventkit; 24 | 25 | HybridObjectRegistry::registerHybridObjectConstructor( 26 | "EventKit", 27 | []() -> std::shared_ptr { 28 | std::shared_ptr hybridObject = NitroEventKit::NitroEventKitAutolinking::createEventKit(); 29 | return hybridObject; 30 | } 31 | ); 32 | HybridObjectRegistry::registerHybridObjectConstructor( 33 | "CalendarPermission", 34 | []() -> std::shared_ptr { 35 | std::shared_ptr hybridObject = NitroEventKit::NitroEventKitAutolinking::createCalendarPermission(); 36 | return hybridObject; 37 | } 38 | ); 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `() -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: () -> Void 18 | 19 | public init(_ closure: @escaping () -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call() -> Void { 25 | self.closure() 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitParticipantType.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantType.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitParticipantType`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitParticipantType = margelo.nitro.eventkit.EventKitParticipantType 12 | 13 | public extension EventKitParticipantType { 14 | /** 15 | * Get a EventKitParticipantType for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Unknown": 21 | self = .unknown 22 | case "Person": 23 | self = .person 24 | case "Room": 25 | self = .room 26 | case "Resource": 27 | self = .resource 28 | case "Group": 29 | self = .group 30 | default: 31 | return nil 32 | } 33 | } 34 | 35 | /** 36 | * Get the String value this EventKitParticipantType represents. 37 | */ 38 | var stringValue: String { 39 | switch self { 40 | case .unknown: 41 | return "Unknown" 42 | case .person: 43 | return "Person" 44 | case .room: 45 | return "Room" 46 | case .resource: 47 | return "Resource" 48 | case .group: 49 | return "Group" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); 3 | const escape = require('escape-string-regexp'); 4 | const exclusionList = require('metro-config/src/defaults/exclusionList'); 5 | 6 | const pack = require('../package.json'); 7 | 8 | const root = path.resolve(__dirname, '..'); 9 | const modules = Object.keys(pack.peerDependencies || {}); 10 | 11 | /** 12 | * Metro configuration 13 | * https://reactnative.dev/docs/metro 14 | * 15 | * @type {import('metro-config').MetroConfig} 16 | */ 17 | const config = { 18 | projectRoot: __dirname, 19 | watchFolders: [root], 20 | 21 | // We need to make sure that only one version is loaded for peerDependencies 22 | // So we exclude them at the root, and alias them to the versions in example's node_modules 23 | resolver: { 24 | blacklistRE: exclusionList( 25 | modules.map( 26 | m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`), 27 | ), 28 | ), 29 | 30 | extraNodeModules: modules.reduce( 31 | (acc, name) => { 32 | acc[name] = path.join(__dirname, 'node_modules', name); 33 | return acc; 34 | }, 35 | { 36 | 'react-native-nitro-event-kit': path.join( 37 | __dirname, 38 | 'node_modules', 39 | 'react-native-nitro-event-kit', 40 | ), 41 | }, 42 | ), 43 | }, 44 | }; 45 | 46 | module.exports = mergeConfig(getDefaultConfig(__dirname), config); 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitAvailability.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitAvailability.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitAvailability`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitAvailability = margelo.nitro.eventkit.EventKitAvailability 12 | 13 | public extension EventKitAvailability { 14 | /** 15 | * Get a EventKitAvailability for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "NotSupported": 21 | self = .notsupported 22 | case "Busy": 23 | self = .busy 24 | case "Free": 25 | self = .free 26 | case "Tentative": 27 | self = .tentative 28 | case "Unavailable": 29 | self = .unavailable 30 | default: 31 | return nil 32 | } 33 | } 34 | 35 | /** 36 | * Get the String value this EventKitAvailability represents. 37 | */ 38 | var stringValue: String { 39 | switch self { 40 | case .notsupported: 41 | return "NotSupported" 42 | case .busy: 43 | return "Busy" 44 | case .free: 45 | return "Free" 46 | case .tentative: 47 | return "Tentative" 48 | case .unavailable: 49 | return "Unavailable" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitCalendarType.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCalendarType.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitCalendarType`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitCalendarType = margelo.nitro.eventkit.EventKitCalendarType 12 | 13 | public extension EventKitCalendarType { 14 | /** 15 | * Get a EventKitCalendarType for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Local": 21 | self = .local 22 | case "CalDAV": 23 | self = .caldav 24 | case "Exchange": 25 | self = .exchange 26 | case "Subscription": 27 | self = .subscription 28 | case "Birthday": 29 | self = .birthday 30 | default: 31 | return nil 32 | } 33 | } 34 | 35 | /** 36 | * Get the String value this EventKitCalendarType represents. 37 | */ 38 | var stringValue: String { 39 | switch self { 40 | case .local: 41 | return "Local" 42 | case .caldav: 43 | return "CalDAV" 44 | case .exchange: 45 | return "Exchange" 46 | case .subscription: 47 | return "Subscription" 48 | case .birthday: 49 | return "Birthday" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitParticipantRole.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantRole.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitParticipantRole`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitParticipantRole = margelo.nitro.eventkit.EventKitParticipantRole 12 | 13 | public extension EventKitParticipantRole { 14 | /** 15 | * Get a EventKitParticipantRole for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Unknown": 21 | self = .unknown 22 | case "Required": 23 | self = .required 24 | case "Optional": 25 | self = .optional 26 | case "Chair": 27 | self = .chair 28 | case "NonParticipant": 29 | self = .nonparticipant 30 | default: 31 | return nil 32 | } 33 | } 34 | 35 | /** 36 | * Get the String value this EventKitParticipantRole represents. 37 | */ 38 | var stringValue: String { 39 | switch self { 40 | case .unknown: 41 | return "Unknown" 42 | case .required: 43 | return "Required" 44 | case .optional: 45 | return "Optional" 46 | case .chair: 47 | return "Chair" 48 | case .nonparticipant: 49 | return "NonParticipant" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_bool.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_bool.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: Bool) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_bool { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: Bool) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: Bool) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: Bool) -> Void { 25 | self.closure(value) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_bool`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitSourceType.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitSourceType.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitSourceType`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitSourceType = margelo.nitro.eventkit.EventKitSourceType 12 | 13 | public extension EventKitSourceType { 14 | /** 15 | * Get a EventKitSourceType for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Local": 21 | self = .local 22 | case "Exchange": 23 | self = .exchange 24 | case "CalDAV": 25 | self = .caldav 26 | case "MobileMe": 27 | self = .mobileme 28 | case "Subscribed": 29 | self = .subscribed 30 | case "Birthdays": 31 | self = .birthdays 32 | default: 33 | return nil 34 | } 35 | } 36 | 37 | /** 38 | * Get the String value this EventKitSourceType represents. 39 | */ 40 | var stringValue: String { 41 | switch self { 42 | case .local: 43 | return "Local" 44 | case .exchange: 45 | return "Exchange" 46 | case .caldav: 47 | return "CalDAV" 48 | case .mobileme: 49 | return "MobileMe" 50 | case .subscribed: 51 | return "Subscribed" 52 | case .birthdays: 53 | return "Birthdays" 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_EventKitEvent.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_EventKitEvent.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: EventKitEvent) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_EventKitEvent { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: EventKitEvent) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: EventKitEvent) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: EventKitEvent) -> Void { 25 | self.closure(value) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_EventKitEvent`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_EventKitEvent { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "lint": "eslint .", 9 | "start": "react-native start", 10 | "test": "jest" 11 | }, 12 | "dependencies": { 13 | "@react-navigation/native": "^7.0.14", 14 | "@react-navigation/native-stack": "^7.2.0", 15 | "dayjs": "^1.11.19", 16 | "react": "19.1.0", 17 | "react-native": "0.81.0", 18 | "react-native-gesture-handler": "^2.29.1", 19 | "react-native-nitro-event-kit": "link:../", 20 | "react-native-nitro-modules": "0.31.5", 21 | "react-native-safe-area-context": "^5.6.2", 22 | "react-native-screens": "^4.14.1" 23 | }, 24 | "devDependencies": { 25 | "@babel/core": "^7.25.2", 26 | "@babel/preset-env": "^7.25.3", 27 | "@babel/runtime": "^7.25.0", 28 | "@commitlint/cli": "^19.7.1", 29 | "@react-native-community/cli": "20.0.0", 30 | "@react-native-community/cli-platform-android": "20.0.0", 31 | "@react-native-community/cli-platform-ios": "20.0.0", 32 | "@react-native/babel-preset": "0.81.0", 33 | "@react-native/eslint-config": "0.81.0", 34 | "@react-native/metro-config": "0.81.0", 35 | "@react-native/typescript-config": "0.81.0", 36 | "@types/jest": "^29.5.13", 37 | "@types/react": "^18.2.6", 38 | "@types/react-test-renderer": "^18.0.0", 39 | "eslint": "^8.19.0", 40 | "husky": "^9.1.7", 41 | "jest": "^29.6.3", 42 | "prettier": "^3.4.2", 43 | "react-test-renderer": "18.3.1", 44 | "typescript": "5.0.4" 45 | }, 46 | "engines": { 47 | "node": ">=22" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitPermissionResult.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitPermissionResult.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS union `EventKitPermissionResult`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitPermissionResult = margelo.nitro.eventkit.EventKitPermissionResult 12 | 13 | public extension EventKitPermissionResult { 14 | /** 15 | * Get a EventKitPermissionResult for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "denied": 21 | self = .denied 22 | case "notDetermined": 23 | self = .notdetermined 24 | case "restricted": 25 | self = .restricted 26 | case "fullAccess": 27 | self = .fullaccess 28 | case "writeOnly": 29 | self = .writeonly 30 | case "unavailable": 31 | self = .unavailable 32 | default: 33 | return nil 34 | } 35 | } 36 | 37 | /** 38 | * Get the String value this EventKitPermissionResult represents. 39 | */ 40 | var stringValue: String { 41 | switch self { 42 | case .denied: 43 | return "denied" 44 | case .notdetermined: 45 | return "notDetermined" 46 | case .restricted: 47 | return "restricted" 48 | case .fullaccess: 49 | return "fullAccess" 50 | case .writeonly: 51 | return "writeOnly" 52 | case .unavailable: 53 | return "unavailable" 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_EventKitCalendar.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_EventKitCalendar.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: EventKitCalendar) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_EventKitCalendar { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: EventKitCalendar) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: EventKitCalendar) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: EventKitCalendar) -> Void { 25 | self.closure(value) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_EventKitCalendar`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_EventKitCalendar { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_std__exception_ptr.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ error: Error) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_std__exception_ptr { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ error: Error) -> Void 18 | 19 | public init(_ closure: @escaping (_ error: Error) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(error: std.exception_ptr) -> Void { 25 | self.closure(RuntimeError.from(cppError: error)) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_std__exception_ptr`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_std__vector_EventKitEvent_.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_std__vector_EventKitEvent_.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: [EventKitEvent]) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_std__vector_EventKitEvent_ { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: [EventKitEvent]) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: [EventKitEvent]) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: bridge.std__vector_EventKitEvent_) -> Void { 25 | self.closure(value.map({ __item in __item })) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_std__vector_EventKitEvent_`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_EventKitEvent_ { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_EventKitPermissionResult.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_EventKitPermissionResult.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: EventKitPermissionResult) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_EventKitPermissionResult { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: EventKitPermissionResult) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: EventKitPermissionResult) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: Int32) -> Void { 25 | self.closure(margelo.nitro.eventkit.EventKitPermissionResult(rawValue: value)!) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_EventKitPermissionResult`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_EventKitPermissionResult { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/Func_void_std__vector_EventKitCalendar_.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// Func_void_std__vector_EventKitCalendar_.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Wraps a Swift `(_ value: [EventKitCalendar]) -> Void` as a class. 12 | * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. 13 | */ 14 | public final class Func_void_std__vector_EventKitCalendar_ { 15 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 16 | 17 | private let closure: (_ value: [EventKitCalendar]) -> Void 18 | 19 | public init(_ closure: @escaping (_ value: [EventKitCalendar]) -> Void) { 20 | self.closure = closure 21 | } 22 | 23 | @inline(__always) 24 | public func call(value: bridge.std__vector_EventKitCalendar_) -> Void { 25 | self.closure(value.map({ __item in __item })) 26 | } 27 | 28 | /** 29 | * Casts this instance to a retained unsafe raw pointer. 30 | * This acquires one additional strong reference on the object! 31 | */ 32 | @inline(__always) 33 | public func toUnsafe() -> UnsafeMutableRawPointer { 34 | return Unmanaged.passRetained(self).toOpaque() 35 | } 36 | 37 | /** 38 | * Casts an unsafe pointer to a `Func_void_std__vector_EventKitCalendar_`. 39 | * The pointer has to be a retained opaque `Unmanaged`. 40 | * This removes one strong reference from the object! 41 | */ 42 | @inline(__always) 43 | public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_EventKitCalendar_ { 44 | return Unmanaged.fromOpaque(pointer).takeRetainedValue() 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import android.app.Application 4 | import com.facebook.react.PackageList 5 | import com.facebook.react.ReactApplication 6 | import com.facebook.react.ReactHost 7 | import com.facebook.react.ReactNativeHost 8 | import com.facebook.react.ReactPackage 9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 11 | import com.facebook.react.defaults.DefaultReactNativeHost 12 | import com.facebook.react.soloader.OpenSourceMergedSoMapping 13 | import com.facebook.soloader.SoLoader 14 | 15 | class MainApplication : Application(), ReactApplication { 16 | 17 | override val reactNativeHost: ReactNativeHost = 18 | object : DefaultReactNativeHost(this) { 19 | override fun getPackages(): List = 20 | PackageList(this).packages.apply { 21 | // Packages that cannot be autolinked yet can be added manually here, for example: 22 | // add(MyReactNativePackage()) 23 | } 24 | 25 | override fun getJSMainModuleName(): String = "index" 26 | 27 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 28 | 29 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 30 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 31 | } 32 | 33 | override val reactHost: ReactHost 34 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 35 | 36 | override fun onCreate() { 37 | super.onCreate() 38 | SoLoader.init(this, OpenSourceMergedSoMapping) 39 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 40 | // If you opted-in for the New Architecture, we load the native entry point for this app. 41 | load() 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitParticipantStatus.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantStatus.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | /** 9 | * Represents the JS enum `EventKitParticipantStatus`, backed by a C++ enum. 10 | */ 11 | public typealias EventKitParticipantStatus = margelo.nitro.eventkit.EventKitParticipantStatus 12 | 13 | public extension EventKitParticipantStatus { 14 | /** 15 | * Get a EventKitParticipantStatus for the given String value, or 16 | * return `nil` if the given value was invalid/unknown. 17 | */ 18 | init?(fromString string: String) { 19 | switch string { 20 | case "Unknown": 21 | self = .unknown 22 | case "Pending": 23 | self = .pending 24 | case "Accepted": 25 | self = .accepted 26 | case "Declined": 27 | self = .declined 28 | case "Tentative": 29 | self = .tentative 30 | case "Delegated": 31 | self = .delegated 32 | case "Completed": 33 | self = .completed 34 | case "InProcess": 35 | self = .inprocess 36 | default: 37 | return nil 38 | } 39 | } 40 | 41 | /** 42 | * Get the String value this EventKitParticipantStatus represents. 43 | */ 44 | var stringValue: String { 45 | switch self { 46 | case .unknown: 47 | return "Unknown" 48 | case .pending: 49 | return "Pending" 50 | case .accepted: 51 | return "Accepted" 52 | case .declined: 53 | return "Declined" 54 | case .tentative: 55 | return "Tentative" 56 | case .delegated: 57 | return "Delegated" 58 | case .completed: 59 | return "Completed" 60 | case .inprocess: 61 | return "InProcess" 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/HybridCalendarPermissionSpec.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridCalendarPermissionSpec.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import Foundation 9 | import NitroModules 10 | 11 | /// See ``HybridCalendarPermissionSpec`` 12 | public protocol HybridCalendarPermissionSpec_protocol: HybridObject { 13 | // Properties 14 | 15 | 16 | // Methods 17 | func getPermissionsStatus() throws -> EventKitPermissionResult 18 | func requestPermission() throws -> Promise 19 | } 20 | 21 | /// See ``HybridCalendarPermissionSpec`` 22 | public class HybridCalendarPermissionSpec_base { 23 | private weak var cxxWrapper: HybridCalendarPermissionSpec_cxx? = nil 24 | public func getCxxWrapper() -> HybridCalendarPermissionSpec_cxx { 25 | #if DEBUG 26 | guard self is HybridCalendarPermissionSpec else { 27 | fatalError("`self` is not a `HybridCalendarPermissionSpec`! Did you accidentally inherit from `HybridCalendarPermissionSpec_base` instead of `HybridCalendarPermissionSpec`?") 28 | } 29 | #endif 30 | if let cxxWrapper = self.cxxWrapper { 31 | return cxxWrapper 32 | } else { 33 | let cxxWrapper = HybridCalendarPermissionSpec_cxx(self as! HybridCalendarPermissionSpec) 34 | self.cxxWrapper = cxxWrapper 35 | return cxxWrapper 36 | } 37 | } 38 | } 39 | 40 | /** 41 | * A Swift base-protocol representing the CalendarPermission HybridObject. 42 | * Implement this protocol to create Swift-based instances of CalendarPermission. 43 | * ```swift 44 | * class HybridCalendarPermission : HybridCalendarPermissionSpec { 45 | * // ... 46 | * } 47 | * ``` 48 | */ 49 | public typealias HybridCalendarPermissionSpec = HybridCalendarPermissionSpec_protocol & HybridCalendarPermissionSpec_base 50 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | 25 | # Use this property to specify which architecture you want to build. 26 | # You can also override it from the CLI using 27 | # ./gradlew -PreactNativeArchitectures=x86_64 28 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 29 | 30 | # Use this property to enable support to the new architecture. 31 | # This will allow you to use TurboModules and the Fabric render in 32 | # your application. You should enable this flag either if you want 33 | # to write custom TurboModules/Fabric components OR use libraries that 34 | # are providing them. 35 | newArchEnabled=true 36 | 37 | # Use this property to enable or disable the Hermes JS engine. 38 | # If set to false, you will be using JSC instead. 39 | hermesEnabled=true 40 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/MonthlyEventOptions.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// MonthlyEventOptions.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `MonthlyEventOptions`, backed by a C++ struct. 12 | */ 13 | public typealias MonthlyEventOptions = margelo.nitro.eventkit.MonthlyEventOptions 14 | 15 | public extension MonthlyEventOptions { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `MonthlyEventOptions`. 20 | */ 21 | init(entityType: EventKitEntityType, calendarId: String?) { 22 | self.init(entityType, { () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = calendarId { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }()) 29 | } 30 | 31 | var entityType: EventKitEntityType { 32 | @inline(__always) 33 | get { 34 | return self.__entityType 35 | } 36 | @inline(__always) 37 | set { 38 | self.__entityType = newValue 39 | } 40 | } 41 | 42 | var calendarId: String? { 43 | @inline(__always) 44 | get { 45 | return { () -> String? in 46 | if let __unwrapped = self.__calendarId.value { 47 | return String(__unwrapped) 48 | } else { 49 | return nil 50 | } 51 | }() 52 | } 53 | @inline(__always) 54 | set { 55 | self.__calendarId = { () -> bridge.std__optional_std__string_ in 56 | if let __unwrappedValue = newValue { 57 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 58 | } else { 59 | return .init() 60 | } 61 | }() 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /example/ios/example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSAllowsLocalNetworking 32 | 33 | 34 | NSCalendarsUsageDescription 35 | This app requires access to your calendar to create and manage events. 36 | NSLocationWhenInUseUsageDescription 37 | 38 | RCTNewArchEnabled 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | arm64 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/NitroEventKitAutolinking.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// NitroEventKitAutolinking.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | public final class NitroEventKitAutolinking { 9 | public typealias bridge = margelo.nitro.eventkit.bridge.swift 10 | 11 | /** 12 | * Creates an instance of a Swift class that implements `HybridEventKitSpec`, 13 | * and wraps it in a Swift class that can directly interop with C++ (`HybridEventKitSpec_cxx`) 14 | * 15 | * This is generated by Nitrogen and will initialize the class specified 16 | * in the `"autolinking"` property of `nitro.json` (in this case, `HybridEventKit`). 17 | */ 18 | public static func createEventKit() -> bridge.std__shared_ptr_margelo__nitro__eventkit__HybridEventKitSpec_ { 19 | let hybridObject = HybridEventKit() 20 | return { () -> bridge.std__shared_ptr_margelo__nitro__eventkit__HybridEventKitSpec_ in 21 | let __cxxWrapped = hybridObject.getCxxWrapper() 22 | return __cxxWrapped.getCxxPart() 23 | }() 24 | } 25 | 26 | /** 27 | * Creates an instance of a Swift class that implements `HybridCalendarPermissionSpec`, 28 | * and wraps it in a Swift class that can directly interop with C++ (`HybridCalendarPermissionSpec_cxx`) 29 | * 30 | * This is generated by Nitrogen and will initialize the class specified 31 | * in the `"autolinking"` property of `nitro.json` (in this case, `HybridCalendarPermission`). 32 | */ 33 | public static func createCalendarPermission() -> bridge.std__shared_ptr_margelo__nitro__eventkit__HybridCalendarPermissionSpec_ { 34 | let hybridObject = HybridCalendarPermission() 35 | return { () -> bridge.std__shared_ptr_margelo__nitro__eventkit__HybridCalendarPermissionSpec_ in 36 | let __cxxWrapped = hybridObject.getCxxWrapper() 37 | return __cxxWrapped.getCxxPart() 38 | }() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ios/EventKitError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventKitError.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 07.02.2025. 6 | // 7 | 8 | import Foundation 9 | 10 | enum EventKitError: Int { 11 | case calendarAvailability = 1 12 | case calendarExistence = 2 13 | case calendarIsReadOnly = 3 14 | case eventCreationFailed = 4 15 | case rootViewControllerNotFound = 5 16 | case eventIdentifierNotFound = 6 17 | case calendarCreationFailed = 7 18 | case calendarSourceNotFound = 8 19 | case calendarSavingFailed = 9 20 | case calendarSourceInvalid = 10 21 | case eventUpdateFailed = 11 22 | 23 | var message: String { 24 | switch self { 25 | case .calendarAvailability: 26 | return "Calendar access is not available" 27 | case .calendarExistence: 28 | return "Calendar with the given identifier was not found" 29 | case .calendarIsReadOnly: 30 | return "Calendar is read-only" 31 | case .eventCreationFailed: 32 | return "Failed to create event" 33 | case .rootViewControllerNotFound: 34 | return "Failed to find rootViewController" 35 | case .eventIdentifierNotFound: 36 | return "Failed to found event with such identifier" 37 | case .calendarCreationFailed: 38 | return "Failed to create event" 39 | case .calendarSourceNotFound: 40 | return "No valid calendar source found" 41 | case .calendarSavingFailed: 42 | return "Failed to save calendar" 43 | case .calendarSourceInvalid: 44 | return "Calendar source in invalid" 45 | case .eventUpdateFailed: 46 | return "Failed to update event" 47 | } 48 | } 49 | 50 | var nsError: NSError { 51 | return NSError( 52 | domain: "HybridEventKit", 53 | code: self.rawValue, 54 | userInfo: [NSLocalizedDescriptionKey: self.message] 55 | ) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitEntityMask.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitEntityMask.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitEntityMask`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitEntityMask = margelo.nitro.eventkit.EventKitEntityMask 14 | 15 | public extension EventKitEntityMask { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitEntityMask`. 20 | */ 21 | init(Event: Bool?, Reminder: Bool?) { 22 | self.init({ () -> bridge.std__optional_bool_ in 23 | if let __unwrappedValue = Event { 24 | return bridge.create_std__optional_bool_(__unwrappedValue) 25 | } else { 26 | return .init() 27 | } 28 | }(), { () -> bridge.std__optional_bool_ in 29 | if let __unwrappedValue = Reminder { 30 | return bridge.create_std__optional_bool_(__unwrappedValue) 31 | } else { 32 | return .init() 33 | } 34 | }()) 35 | } 36 | 37 | var Event: Bool? { 38 | @inline(__always) 39 | get { 40 | return self.__Event.value 41 | } 42 | @inline(__always) 43 | set { 44 | self.__Event = { () -> bridge.std__optional_bool_ in 45 | if let __unwrappedValue = newValue { 46 | return bridge.create_std__optional_bool_(__unwrappedValue) 47 | } else { 48 | return .init() 49 | } 50 | }() 51 | } 52 | } 53 | 54 | var Reminder: Bool? { 55 | @inline(__always) 56 | get { 57 | return self.__Reminder.value 58 | } 59 | @inline(__always) 60 | set { 61 | self.__Reminder = { () -> bridge.std__optional_bool_ in 62 | if let __unwrappedValue = newValue { 63 | return bridge.create_std__optional_bool_(__unwrappedValue) 64 | } else { 65 | return .init() 66 | } 67 | }() 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/CreateEventLocation.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// CreateEventLocation.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `CreateEventLocation`, backed by a C++ struct. 12 | */ 13 | public typealias CreateEventLocation = margelo.nitro.eventkit.CreateEventLocation 14 | 15 | public extension CreateEventLocation { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `CreateEventLocation`. 20 | */ 21 | init(title: String?, latitude: Double, longitude: Double) { 22 | self.init({ () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = title { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }(), latitude, longitude) 29 | } 30 | 31 | var title: String? { 32 | @inline(__always) 33 | get { 34 | return { () -> String? in 35 | if let __unwrapped = self.__title.value { 36 | return String(__unwrapped) 37 | } else { 38 | return nil 39 | } 40 | }() 41 | } 42 | @inline(__always) 43 | set { 44 | self.__title = { () -> bridge.std__optional_std__string_ in 45 | if let __unwrappedValue = newValue { 46 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 47 | } else { 48 | return .init() 49 | } 50 | }() 51 | } 52 | } 53 | 54 | var latitude: Double { 55 | @inline(__always) 56 | get { 57 | return self.__latitude 58 | } 59 | @inline(__always) 60 | set { 61 | self.__latitude = newValue 62 | } 63 | } 64 | 65 | var longitude: Double { 66 | @inline(__always) 67 | get { 68 | return self.__longitude 69 | } 70 | @inline(__always) 71 | set { 72 | self.__longitude = newValue 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/HybridCalendarPermissionSpec.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridCalendarPermissionSpec.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | 16 | // Forward declaration of `EventKitPermissionResult` to properly resolve imports. 17 | namespace margelo::nitro::eventkit { enum class EventKitPermissionResult; } 18 | 19 | #include "EventKitPermissionResult.hpp" 20 | #include 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | using namespace margelo::nitro; 25 | 26 | /** 27 | * An abstract base class for `CalendarPermission` 28 | * Inherit this class to create instances of `HybridCalendarPermissionSpec` in C++. 29 | * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. 30 | * @example 31 | * ```cpp 32 | * class HybridCalendarPermission: public HybridCalendarPermissionSpec { 33 | * public: 34 | * HybridCalendarPermission(...): HybridObject(TAG) { ... } 35 | * // ... 36 | * }; 37 | * ``` 38 | */ 39 | class HybridCalendarPermissionSpec: public virtual HybridObject { 40 | public: 41 | // Constructor 42 | explicit HybridCalendarPermissionSpec(): HybridObject(TAG) { } 43 | 44 | // Destructor 45 | ~HybridCalendarPermissionSpec() override = default; 46 | 47 | public: 48 | // Properties 49 | 50 | 51 | public: 52 | // Methods 53 | virtual EventKitPermissionResult getPermissionsStatus() = 0; 54 | virtual std::shared_ptr> requestPermission() = 0; 55 | 56 | protected: 57 | // Hybrid Setup 58 | void loadHybridMethods() override; 59 | 60 | protected: 61 | // Tag for logging 62 | static constexpr auto TAG = "CalendarPermission"; 63 | }; 64 | 65 | } // namespace margelo::nitro::eventkit 66 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/HybridEventKitSpec.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridEventKitSpec.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import Foundation 9 | import NitroModules 10 | 11 | /// See ``HybridEventKitSpec`` 12 | public protocol HybridEventKitSpec_protocol: HybridObject { 13 | // Properties 14 | 15 | 16 | // Methods 17 | func getActiveCalendars() throws -> Promise<[EventKitCalendar]> 18 | func getMonthlyCalendarEvents(options: MonthlyEventOptions) throws -> Promise<[EventKitEvent]> 19 | func getCalendarEventsByRange(options: RangeEventOptions) throws -> Promise<[EventKitEvent]> 20 | func createEvent(options: CreateEventOptions) throws -> Promise 21 | func deleteEvent(eventIdentifier: String) throws -> Promise 22 | func openCalendarEvent(eventIdentifier: String) throws -> Promise 23 | func createCalendar(options: CreateCalendarOptions) throws -> Promise 24 | func editEvent(eventIdentifier: String, options: EditEventOptions) throws -> Promise 25 | } 26 | 27 | /// See ``HybridEventKitSpec`` 28 | public class HybridEventKitSpec_base { 29 | private weak var cxxWrapper: HybridEventKitSpec_cxx? = nil 30 | public func getCxxWrapper() -> HybridEventKitSpec_cxx { 31 | #if DEBUG 32 | guard self is HybridEventKitSpec else { 33 | fatalError("`self` is not a `HybridEventKitSpec`! Did you accidentally inherit from `HybridEventKitSpec_base` instead of `HybridEventKitSpec`?") 34 | } 35 | #endif 36 | if let cxxWrapper = self.cxxWrapper { 37 | return cxxWrapper 38 | } else { 39 | let cxxWrapper = HybridEventKitSpec_cxx(self as! HybridEventKitSpec) 40 | self.cxxWrapper = cxxWrapper 41 | return cxxWrapper 42 | } 43 | } 44 | } 45 | 46 | /** 47 | * A Swift base-protocol representing the EventKit HybridObject. 48 | * Implement this protocol to create Swift-based instances of EventKit. 49 | * ```swift 50 | * class HybridEventKit : HybridEventKitSpec { 51 | * // ... 52 | * } 53 | * ``` 54 | */ 55 | public typealias HybridEventKitSpec = HybridEventKitSpec_protocol & HybridEventKitSpec_base 56 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitSource.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitSource.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitSource`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitSource = margelo.nitro.eventkit.EventKitSource 14 | 15 | public extension EventKitSource { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitSource`. 20 | */ 21 | init(sourceIdentifier: String, sourceType: EventKitSourceType, title: String, isDelegate: Bool?) { 22 | self.init(std.string(sourceIdentifier), sourceType, std.string(title), { () -> bridge.std__optional_bool_ in 23 | if let __unwrappedValue = isDelegate { 24 | return bridge.create_std__optional_bool_(__unwrappedValue) 25 | } else { 26 | return .init() 27 | } 28 | }()) 29 | } 30 | 31 | var sourceIdentifier: String { 32 | @inline(__always) 33 | get { 34 | return String(self.__sourceIdentifier) 35 | } 36 | @inline(__always) 37 | set { 38 | self.__sourceIdentifier = std.string(newValue) 39 | } 40 | } 41 | 42 | var sourceType: EventKitSourceType { 43 | @inline(__always) 44 | get { 45 | return self.__sourceType 46 | } 47 | @inline(__always) 48 | set { 49 | self.__sourceType = newValue 50 | } 51 | } 52 | 53 | var title: String { 54 | @inline(__always) 55 | get { 56 | return String(self.__title) 57 | } 58 | @inline(__always) 59 | set { 60 | self.__title = std.string(newValue) 61 | } 62 | } 63 | 64 | var isDelegate: Bool? { 65 | @inline(__always) 66 | get { 67 | return self.__isDelegate.value 68 | } 69 | @inline(__always) 70 | set { 71 | self.__isDelegate = { () -> bridge.std__optional_bool_ in 72 | if let __unwrappedValue = newValue { 73 | return bridge.create_std__optional_bool_(__unwrappedValue) 74 | } else { 75 | return .init() 76 | } 77 | }() 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/NitroEventKit+autolinking.rb: -------------------------------------------------------------------------------- 1 | # 2 | # NitroEventKit+autolinking.rb 3 | # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | # https://github.com/mrousavy/nitro 5 | # Copyright © 2025 Marc Rousavy @ Margelo 6 | # 7 | 8 | # This is a Ruby script that adds all files generated by Nitrogen 9 | # to the given podspec. 10 | # 11 | # To use it, add this to your .podspec: 12 | # ```ruby 13 | # Pod::Spec.new do |spec| 14 | # # ... 15 | # 16 | # # Add all files generated by Nitrogen 17 | # load 'nitrogen/generated/ios/NitroEventKit+autolinking.rb' 18 | # add_nitrogen_files(spec) 19 | # end 20 | # ``` 21 | 22 | def add_nitrogen_files(spec) 23 | Pod::UI.puts "[NitroModules] 🔥 NitroEventKit is boosted by nitro!" 24 | 25 | spec.dependency "NitroModules" 26 | 27 | current_source_files = Array(spec.attributes_hash['source_files']) 28 | spec.source_files = current_source_files + [ 29 | # Generated cross-platform specs 30 | "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}", 31 | # Generated bridges for the cross-platform specs 32 | "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}", 33 | ] 34 | 35 | current_public_header_files = Array(spec.attributes_hash['public_header_files']) 36 | spec.public_header_files = current_public_header_files + [ 37 | # Generated specs 38 | "nitrogen/generated/shared/**/*.{h,hpp}", 39 | # Swift to C++ bridging helpers 40 | "nitrogen/generated/ios/NitroEventKit-Swift-Cxx-Bridge.hpp" 41 | ] 42 | 43 | current_private_header_files = Array(spec.attributes_hash['private_header_files']) 44 | spec.private_header_files = current_private_header_files + [ 45 | # iOS specific specs 46 | "nitrogen/generated/ios/c++/**/*.{h,hpp}", 47 | # Views are framework-specific and should be private 48 | "nitrogen/generated/shared/**/views/**/*" 49 | ] 50 | 51 | current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {} 52 | spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({ 53 | # Use C++ 20 54 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", 55 | # Enables C++ <-> Swift interop (by default it's only C) 56 | "SWIFT_OBJC_INTEROP_MODE" => "objcxx", 57 | # Enables stricter modular headers 58 | "DEFINES_MODULE" => "YES", 59 | }) 60 | end 61 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitEntityType.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitEntityType.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitEntityType). 26 | */ 27 | enum class EventKitEntityType { 28 | EVENT SWIFT_NAME(event) = 0, 29 | REMINDER SWIFT_NAME(reminder) = 1, 30 | } CLOSED_ENUM; 31 | 32 | } // namespace margelo::nitro::eventkit 33 | 34 | namespace margelo::nitro { 35 | 36 | using namespace margelo::nitro::eventkit; 37 | 38 | // C++ EventKitEntityType <> JS EventKitEntityType (enum) 39 | template <> 40 | struct JSIConverter final { 41 | static inline EventKitEntityType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 42 | int enumValue = JSIConverter::fromJSI(runtime, arg); 43 | return static_cast(enumValue); 44 | } 45 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitEntityType arg) { 46 | int enumValue = static_cast(arg); 47 | return JSIConverter::toJSI(runtime, enumValue); 48 | } 49 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 50 | if (!value.isNumber()) { 51 | return false; 52 | } 53 | double integer; 54 | double fraction = modf(value.getNumber(), &integer); 55 | if (fraction != 0.0) { 56 | // It is some kind of floating point number - our enums are ints. 57 | return false; 58 | } 59 | // Check if we are within the bounds of the enum. 60 | return integer >= 0 && integer <= 1; 61 | } 62 | }; 63 | 64 | } // namespace margelo::nitro 65 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitStatus.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitStatus.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitStatus). 26 | */ 27 | enum class EventKitStatus { 28 | NONE SWIFT_NAME(none) = 0, 29 | CONFIRMED SWIFT_NAME(confirmed) = 1, 30 | TENTATIVE SWIFT_NAME(tentative) = 2, 31 | CANCELED SWIFT_NAME(canceled) = 3, 32 | } CLOSED_ENUM; 33 | 34 | } // namespace margelo::nitro::eventkit 35 | 36 | namespace margelo::nitro { 37 | 38 | using namespace margelo::nitro::eventkit; 39 | 40 | // C++ EventKitStatus <> JS EventKitStatus (enum) 41 | template <> 42 | struct JSIConverter final { 43 | static inline EventKitStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 44 | int enumValue = JSIConverter::fromJSI(runtime, arg); 45 | return static_cast(enumValue); 46 | } 47 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitStatus arg) { 48 | int enumValue = static_cast(arg); 49 | return JSIConverter::toJSI(runtime, enumValue); 50 | } 51 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 52 | if (!value.isNumber()) { 53 | return false; 54 | } 55 | double integer; 56 | double fraction = modf(value.getNumber(), &integer); 57 | if (fraction != 0.0) { 58 | // It is some kind of floating point number - our enums are ints. 59 | return false; 60 | } 61 | // Check if we are within the bounds of the enum. 62 | return integer >= 0 && integer <= 3; 63 | } 64 | }; 65 | 66 | } // namespace margelo::nitro 67 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/RangeEventOptions.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// RangeEventOptions.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `RangeEventOptions`, backed by a C++ struct. 12 | */ 13 | public typealias RangeEventOptions = margelo.nitro.eventkit.RangeEventOptions 14 | 15 | public extension RangeEventOptions { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `RangeEventOptions`. 20 | */ 21 | init(startDate: Double, endDate: Double, entityType: EventKitEntityType, calendarId: String?) { 22 | self.init(startDate, endDate, entityType, { () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = calendarId { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }()) 29 | } 30 | 31 | var startDate: Double { 32 | @inline(__always) 33 | get { 34 | return self.__startDate 35 | } 36 | @inline(__always) 37 | set { 38 | self.__startDate = newValue 39 | } 40 | } 41 | 42 | var endDate: Double { 43 | @inline(__always) 44 | get { 45 | return self.__endDate 46 | } 47 | @inline(__always) 48 | set { 49 | self.__endDate = newValue 50 | } 51 | } 52 | 53 | var entityType: EventKitEntityType { 54 | @inline(__always) 55 | get { 56 | return self.__entityType 57 | } 58 | @inline(__always) 59 | set { 60 | self.__entityType = newValue 61 | } 62 | } 63 | 64 | var calendarId: String? { 65 | @inline(__always) 66 | get { 67 | return { () -> String? in 68 | if let __unwrapped = self.__calendarId.value { 69 | return String(__unwrapped) 70 | } else { 71 | return nil 72 | } 73 | }() 74 | } 75 | @inline(__always) 76 | set { 77 | self.__calendarId = { () -> bridge.std__optional_std__string_ in 78 | if let __unwrappedValue = newValue { 79 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 80 | } else { 81 | return .init() 82 | } 83 | }() 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /ios/UIColor+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Extension.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 07.02.2025. 6 | // 7 | import UIKit 8 | 9 | extension UIColor { 10 | var hexString: String? { 11 | var red: CGFloat = 0 12 | var green: CGFloat = 0 13 | var blue: CGFloat = 0 14 | var alpha: CGFloat = 0 15 | 16 | let multiplier = CGFloat(255.999999) 17 | 18 | guard self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) 19 | else { 20 | return nil 21 | } 22 | 23 | if alpha == 1.0 { 24 | return String( 25 | format: "#%02lX%02lX%02lX", 26 | Int(red * multiplier), 27 | Int(green * multiplier), 28 | Int(blue * multiplier) 29 | ) 30 | } else { 31 | return String( 32 | format: "#%02lX%02lX%02lX%02lX", 33 | Int(red * multiplier), 34 | Int(green * multiplier), 35 | Int(blue * multiplier), 36 | Int(alpha * multiplier) 37 | ) 38 | } 39 | } 40 | 41 | convenience init?(hexString: String) { 42 | var hex = hexString.trimmingCharacters(in: .whitespacesAndNewlines) 43 | .uppercased() 44 | 45 | if hex.hasPrefix("#") { 46 | hex.removeFirst() 47 | } 48 | 49 | var rgbValue: UInt64 = 0 50 | guard Scanner(string: hex).scanHexInt64(&rgbValue) else { return nil } 51 | 52 | switch hex.count { 53 | case 6: 54 | self.init( 55 | red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, 56 | green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, 57 | blue: CGFloat(rgbValue & 0x0000FF) / 255.0, 58 | alpha: 1.0 59 | ) 60 | case 8: 61 | self.init( 62 | red: CGFloat((rgbValue & 0xFF00_0000) >> 24) / 255.0, 63 | green: CGFloat((rgbValue & 0x00FF_0000) >> 16) / 255.0, 64 | blue: CGFloat((rgbValue & 0x0000_FF00) >> 8) / 255.0, 65 | alpha: CGFloat(rgbValue & 0x0000_00FF) / 255.0 66 | ) 67 | default: 68 | return nil 69 | } 70 | } 71 | } 72 | 73 | extension CGColor { 74 | var hexString: String? { 75 | return UIColor(cgColor: self).hexString 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitPredicate.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitPredicate.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | #include 24 | 25 | namespace margelo::nitro::eventkit { 26 | 27 | /** 28 | * A struct which can be represented as a JavaScript object (EventKitPredicate). 29 | */ 30 | struct EventKitPredicate { 31 | public: 32 | std::string predicateFormat SWIFT_PRIVATE; 33 | 34 | public: 35 | EventKitPredicate() = default; 36 | explicit EventKitPredicate(std::string predicateFormat): predicateFormat(predicateFormat) {} 37 | }; 38 | 39 | } // namespace margelo::nitro::eventkit 40 | 41 | namespace margelo::nitro { 42 | 43 | using namespace margelo::nitro::eventkit; 44 | 45 | // C++ EventKitPredicate <> JS EventKitPredicate (object) 46 | template <> 47 | struct JSIConverter final { 48 | static inline EventKitPredicate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 49 | jsi::Object obj = arg.asObject(runtime); 50 | return EventKitPredicate( 51 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "predicateFormat")) 52 | ); 53 | } 54 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitPredicate& arg) { 55 | jsi::Object obj(runtime); 56 | obj.setProperty(runtime, "predicateFormat", JSIConverter::toJSI(runtime, arg.predicateFormat)); 57 | return obj; 58 | } 59 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 60 | if (!value.isObject()) { 61 | return false; 62 | } 63 | jsi::Object obj = value.getObject(runtime); 64 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "predicateFormat"))) return false; 65 | return true; 66 | } 67 | }; 68 | 69 | } // namespace margelo::nitro 70 | -------------------------------------------------------------------------------- /example/src/screens/HomeScreen.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, Text, TouchableOpacity, StyleSheet } from 'react-native'; 3 | import { NativeStackNavigationProp } from '@react-navigation/native-stack'; 4 | 5 | type RootStackParamList = { 6 | Permissions: undefined; 7 | Calendars: undefined; 8 | Events: undefined; 9 | 'Create Event': undefined; 10 | 'Manage Event': undefined; 11 | }; 12 | 13 | type HomeScreenProps = { 14 | navigation: NativeStackNavigationProp; 15 | }; 16 | 17 | export const HomeScreen: React.FC = ({ navigation }) => { 18 | return ( 19 | 20 | React Native Nitro Event Kit 21 | 22 | navigation.navigate('Permissions')}> 25 | Check & Request Permissions 26 | 27 | 28 | navigation.navigate('Calendars')}> 31 | Get Active Calendars 32 | 33 | 34 | navigation.navigate('Events')}> 37 | Fetch Calendar Events 38 | 39 | 40 | navigation.navigate('Create Event')}> 43 | Create New Event 44 | 45 | 46 | navigation.navigate('Manage Event')}> 49 | Manage Events 50 | 51 | 52 | ); 53 | }; 54 | 55 | const styles = StyleSheet.create({ 56 | container: { 57 | flex: 1, 58 | alignItems: 'center', 59 | justifyContent: 'center', 60 | backgroundColor: '#F7F8FC', 61 | }, 62 | title: { fontSize: 22, fontWeight: 'bold', marginBottom: 20 }, 63 | button: { 64 | backgroundColor: '#007AFF', 65 | padding: 12, 66 | margin: 10, 67 | borderRadius: 8, 68 | width: '80%', 69 | alignItems: 'center', 70 | }, 71 | buttonText: { color: '#FFFFFF', fontSize: 16, fontWeight: 'bold' }, 72 | }); 73 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitCalendarType.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCalendarType.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitCalendarType). 26 | */ 27 | enum class EventKitCalendarType { 28 | LOCAL SWIFT_NAME(local) = 0, 29 | CALDAV SWIFT_NAME(caldav) = 1, 30 | EXCHANGE SWIFT_NAME(exchange) = 2, 31 | SUBSCRIPTION SWIFT_NAME(subscription) = 3, 32 | BIRTHDAY SWIFT_NAME(birthday) = 4, 33 | } CLOSED_ENUM; 34 | 35 | } // namespace margelo::nitro::eventkit 36 | 37 | namespace margelo::nitro { 38 | 39 | using namespace margelo::nitro::eventkit; 40 | 41 | // C++ EventKitCalendarType <> JS EventKitCalendarType (enum) 42 | template <> 43 | struct JSIConverter final { 44 | static inline EventKitCalendarType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 45 | int enumValue = JSIConverter::fromJSI(runtime, arg); 46 | return static_cast(enumValue); 47 | } 48 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitCalendarType arg) { 49 | int enumValue = static_cast(arg); 50 | return JSIConverter::toJSI(runtime, enumValue); 51 | } 52 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 53 | if (!value.isNumber()) { 54 | return false; 55 | } 56 | double integer; 57 | double fraction = modf(value.getNumber(), &integer); 58 | if (fraction != 0.0) { 59 | // It is some kind of floating point number - our enums are ints. 60 | return false; 61 | } 62 | // Check if we are within the bounds of the enum. 63 | return integer >= 0 && integer <= 4; 64 | } 65 | }; 66 | 67 | } // namespace margelo::nitro 68 | -------------------------------------------------------------------------------- /example/src/screens/PermissionScreen.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { 3 | View, 4 | Text, 5 | TouchableOpacity, 6 | StyleSheet, 7 | Linking, 8 | } from 'react-native'; 9 | import { 10 | NitroEventKitCalendarPermission, 11 | EventKitPermissionResult, 12 | } from 'react-native-nitro-event-kit'; 13 | 14 | export const PermissionScreen: React.FC = () => { 15 | const [permissionStatus, setPermissionStatus] = 16 | useState('notDetermined'); 17 | 18 | const checkPermission = () => { 19 | const status = NitroEventKitCalendarPermission.getPermissionsStatus(); 20 | setPermissionStatus(status); 21 | }; 22 | 23 | const requestPermission = async () => { 24 | const status = await NitroEventKitCalendarPermission.requestPermission(); 25 | setPermissionStatus(status); 26 | }; 27 | 28 | const openSettings = () => { 29 | Linking.openSettings(); 30 | }; 31 | 32 | return ( 33 | 34 | Calendar Permission 35 | Status: {permissionStatus} 36 | 37 | 38 | Request Permission 39 | 40 | 41 | 42 | Check Permission 43 | 44 | 45 | {permissionStatus === 'denied' && ( 46 | 49 | Open Settings 50 | 51 | )} 52 | 53 | ); 54 | }; 55 | 56 | const styles = StyleSheet.create({ 57 | container: { 58 | flex: 1, 59 | alignItems: 'center', 60 | justifyContent: 'center', 61 | backgroundColor: '#F7F8FC', 62 | padding: 20, 63 | }, 64 | title: { fontSize: 22, fontWeight: 'bold', marginBottom: 10 }, 65 | status: { fontSize: 16, marginBottom: 20, color: '#333' }, 66 | button: { 67 | backgroundColor: '#007AFF', 68 | padding: 12, 69 | margin: 10, 70 | borderRadius: 8, 71 | width: '100%', 72 | alignItems: 'center', 73 | }, 74 | settingsButton: { backgroundColor: '#FF3B30' }, 75 | buttonText: { color: '#FFFFFF', fontSize: 16, fontWeight: 'bold' }, 76 | }); 77 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitAvailability.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitAvailability.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitAvailability). 26 | */ 27 | enum class EventKitAvailability { 28 | NOTSUPPORTED SWIFT_NAME(notsupported) = -1, 29 | BUSY SWIFT_NAME(busy) = 0, 30 | FREE SWIFT_NAME(free) = 1, 31 | TENTATIVE SWIFT_NAME(tentative) = 2, 32 | UNAVAILABLE SWIFT_NAME(unavailable) = 3, 33 | } CLOSED_ENUM; 34 | 35 | } // namespace margelo::nitro::eventkit 36 | 37 | namespace margelo::nitro { 38 | 39 | using namespace margelo::nitro::eventkit; 40 | 41 | // C++ EventKitAvailability <> JS EventKitAvailability (enum) 42 | template <> 43 | struct JSIConverter final { 44 | static inline EventKitAvailability fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 45 | int enumValue = JSIConverter::fromJSI(runtime, arg); 46 | return static_cast(enumValue); 47 | } 48 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitAvailability arg) { 49 | int enumValue = static_cast(arg); 50 | return JSIConverter::toJSI(runtime, enumValue); 51 | } 52 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 53 | if (!value.isNumber()) { 54 | return false; 55 | } 56 | double integer; 57 | double fraction = modf(value.getNumber(), &integer); 58 | if (fraction != 0.0) { 59 | // It is some kind of floating point number - our enums are ints. 60 | return false; 61 | } 62 | // Check if we are within the bounds of the enum. 63 | return integer >= 0 && integer <= 4; 64 | } 65 | }; 66 | 67 | } // namespace margelo::nitro 68 | -------------------------------------------------------------------------------- /ios/HybridCalendarPermission.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HybridCalendarPermission.swift 3 | // NitroEventKit 4 | // 5 | // Created by VLAD on 04.02.2025. 6 | // 7 | 8 | import Foundation 9 | import NitroModules 10 | import EventKit 11 | 12 | class HybridCalendarPermission: HybridCalendarPermissionSpec { 13 | private let eventStore = EventKitManager.shared.eventStore 14 | 15 | func getPermissionsStatus() throws -> EventKitPermissionResult { 16 | let status = EKEventStore.authorizationStatus(for: .event) 17 | return parseStatus(status) 18 | } 19 | 20 | func requestPermission() throws -> NitroModules.Promise { 21 | let promise = Promise() 22 | 23 | let completionHandler: EKEventStoreRequestAccessCompletionHandler = { [weak self] granted, error in 24 | DispatchQueue.main.async { 25 | guard let self = self else { return } 26 | 27 | if let error = error { 28 | promise.reject(withError: error) 29 | return 30 | } 31 | 32 | if granted { 33 | EventKitManager.shared.updateCalendarAccessStatus() 34 | promise.resolve(withResult: .fullaccess) 35 | } else { 36 | do { 37 | let status = try self.getPermissionsStatus() 38 | promise.resolve(withResult: status) 39 | } catch { 40 | promise.reject(withError: error) 41 | } 42 | } 43 | } 44 | } 45 | 46 | if #available(iOS 17.0, *) { 47 | eventStore.requestFullAccessToEvents(completion: completionHandler) 48 | } else { 49 | eventStore.requestAccess(to: .event, completion: completionHandler) 50 | } 51 | 52 | return promise 53 | } 54 | 55 | private func parseStatus(_ status: EKAuthorizationStatus) -> EventKitPermissionResult { 56 | switch status { 57 | case .denied: 58 | return .denied 59 | case .notDetermined: 60 | return .notdetermined 61 | case .restricted: 62 | return .restricted 63 | case .fullAccess: 64 | return .fullaccess 65 | case .writeOnly: 66 | return .writeonly 67 | @unknown default: 68 | return .unavailable 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitParticipantType.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantType.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitParticipantType). 26 | */ 27 | enum class EventKitParticipantType { 28 | UNKNOWN SWIFT_NAME(unknown) = 0, 29 | PERSON SWIFT_NAME(person) = 1, 30 | ROOM SWIFT_NAME(room) = 2, 31 | RESOURCE SWIFT_NAME(resource) = 3, 32 | GROUP SWIFT_NAME(group) = 4, 33 | } CLOSED_ENUM; 34 | 35 | } // namespace margelo::nitro::eventkit 36 | 37 | namespace margelo::nitro { 38 | 39 | using namespace margelo::nitro::eventkit; 40 | 41 | // C++ EventKitParticipantType <> JS EventKitParticipantType (enum) 42 | template <> 43 | struct JSIConverter final { 44 | static inline EventKitParticipantType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 45 | int enumValue = JSIConverter::fromJSI(runtime, arg); 46 | return static_cast(enumValue); 47 | } 48 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitParticipantType arg) { 49 | int enumValue = static_cast(arg); 50 | return JSIConverter::toJSI(runtime, enumValue); 51 | } 52 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 53 | if (!value.isNumber()) { 54 | return false; 55 | } 56 | double integer; 57 | double fraction = modf(value.getNumber(), &integer); 58 | if (fraction != 0.0) { 59 | // It is some kind of floating point number - our enums are ints. 60 | return false; 61 | } 62 | // Check if we are within the bounds of the enum. 63 | return integer >= 0 && integer <= 4; 64 | } 65 | }; 66 | 67 | } // namespace margelo::nitro 68 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitSourceType.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitSourceType.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitSourceType). 26 | */ 27 | enum class EventKitSourceType { 28 | LOCAL SWIFT_NAME(local) = 0, 29 | EXCHANGE SWIFT_NAME(exchange) = 1, 30 | CALDAV SWIFT_NAME(caldav) = 2, 31 | MOBILEME SWIFT_NAME(mobileme) = 3, 32 | SUBSCRIBED SWIFT_NAME(subscribed) = 4, 33 | BIRTHDAYS SWIFT_NAME(birthdays) = 5, 34 | } CLOSED_ENUM; 35 | 36 | } // namespace margelo::nitro::eventkit 37 | 38 | namespace margelo::nitro { 39 | 40 | using namespace margelo::nitro::eventkit; 41 | 42 | // C++ EventKitSourceType <> JS EventKitSourceType (enum) 43 | template <> 44 | struct JSIConverter final { 45 | static inline EventKitSourceType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 46 | int enumValue = JSIConverter::fromJSI(runtime, arg); 47 | return static_cast(enumValue); 48 | } 49 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitSourceType arg) { 50 | int enumValue = static_cast(arg); 51 | return JSIConverter::toJSI(runtime, enumValue); 52 | } 53 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 54 | if (!value.isNumber()) { 55 | return false; 56 | } 57 | double integer; 58 | double fraction = modf(value.getNumber(), &integer); 59 | if (fraction != 0.0) { 60 | // It is some kind of floating point number - our enums are ints. 61 | return false; 62 | } 63 | // Check if we are within the bounds of the enum. 64 | return integer >= 0 && integer <= 5; 65 | } 66 | }; 67 | 68 | } // namespace margelo::nitro 69 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitParticipantRole.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantRole.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitParticipantRole). 26 | */ 27 | enum class EventKitParticipantRole { 28 | UNKNOWN SWIFT_NAME(unknown) = 0, 29 | REQUIRED SWIFT_NAME(required) = 1, 30 | OPTIONAL SWIFT_NAME(optional) = 2, 31 | CHAIR SWIFT_NAME(chair) = 3, 32 | NONPARTICIPANT SWIFT_NAME(nonparticipant) = 4, 33 | } CLOSED_ENUM; 34 | 35 | } // namespace margelo::nitro::eventkit 36 | 37 | namespace margelo::nitro { 38 | 39 | using namespace margelo::nitro::eventkit; 40 | 41 | // C++ EventKitParticipantRole <> JS EventKitParticipantRole (enum) 42 | template <> 43 | struct JSIConverter final { 44 | static inline EventKitParticipantRole fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 45 | int enumValue = JSIConverter::fromJSI(runtime, arg); 46 | return static_cast(enumValue); 47 | } 48 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitParticipantRole arg) { 49 | int enumValue = static_cast(arg); 50 | return JSIConverter::toJSI(runtime, enumValue); 51 | } 52 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 53 | if (!value.isNumber()) { 54 | return false; 55 | } 56 | double integer; 57 | double fraction = modf(value.getNumber(), &integer); 58 | if (fraction != 0.0) { 59 | // It is some kind of floating point number - our enums are ints. 60 | return false; 61 | } 62 | // Check if we are within the bounds of the enum. 63 | return integer >= 0 && integer <= 4; 64 | } 65 | }; 66 | 67 | } // namespace margelo::nitro 68 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitParticipantStatus.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipantStatus.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #if __has_include() 12 | #include 13 | #else 14 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 15 | #endif 16 | #if __has_include() 17 | #include 18 | #else 19 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 20 | #endif 21 | 22 | namespace margelo::nitro::eventkit { 23 | 24 | /** 25 | * An enum which can be represented as a JavaScript enum (EventKitParticipantStatus). 26 | */ 27 | enum class EventKitParticipantStatus { 28 | UNKNOWN SWIFT_NAME(unknown) = 0, 29 | PENDING SWIFT_NAME(pending) = 1, 30 | ACCEPTED SWIFT_NAME(accepted) = 2, 31 | DECLINED SWIFT_NAME(declined) = 3, 32 | TENTATIVE SWIFT_NAME(tentative) = 4, 33 | DELEGATED SWIFT_NAME(delegated) = 5, 34 | COMPLETED SWIFT_NAME(completed) = 6, 35 | INPROCESS SWIFT_NAME(inprocess) = 7, 36 | } CLOSED_ENUM; 37 | 38 | } // namespace margelo::nitro::eventkit 39 | 40 | namespace margelo::nitro { 41 | 42 | using namespace margelo::nitro::eventkit; 43 | 44 | // C++ EventKitParticipantStatus <> JS EventKitParticipantStatus (enum) 45 | template <> 46 | struct JSIConverter final { 47 | static inline EventKitParticipantStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 48 | int enumValue = JSIConverter::fromJSI(runtime, arg); 49 | return static_cast(enumValue); 50 | } 51 | static inline jsi::Value toJSI(jsi::Runtime& runtime, EventKitParticipantStatus arg) { 52 | int enumValue = static_cast(arg); 53 | return JSIConverter::toJSI(runtime, enumValue); 54 | } 55 | static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { 56 | if (!value.isNumber()) { 57 | return false; 58 | } 59 | double integer; 60 | double fraction = modf(value.getNumber(), &integer); 61 | if (fraction != 0.0) { 62 | // It is some kind of floating point number - our enums are ints. 63 | return false; 64 | } 65 | // Check if we are within the bounds of the enum. 66 | return integer >= 0 && integer <= 7; 67 | } 68 | }; 69 | 70 | } // namespace margelo::nitro 71 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitCoordinate.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCoordinate.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | 24 | 25 | namespace margelo::nitro::eventkit { 26 | 27 | /** 28 | * A struct which can be represented as a JavaScript object (EventKitCoordinate). 29 | */ 30 | struct EventKitCoordinate { 31 | public: 32 | double latitude SWIFT_PRIVATE; 33 | double longitude SWIFT_PRIVATE; 34 | 35 | public: 36 | EventKitCoordinate() = default; 37 | explicit EventKitCoordinate(double latitude, double longitude): latitude(latitude), longitude(longitude) {} 38 | }; 39 | 40 | } // namespace margelo::nitro::eventkit 41 | 42 | namespace margelo::nitro { 43 | 44 | using namespace margelo::nitro::eventkit; 45 | 46 | // C++ EventKitCoordinate <> JS EventKitCoordinate (object) 47 | template <> 48 | struct JSIConverter final { 49 | static inline EventKitCoordinate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 50 | jsi::Object obj = arg.asObject(runtime); 51 | return EventKitCoordinate( 52 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "latitude")), 53 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "longitude")) 54 | ); 55 | } 56 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitCoordinate& arg) { 57 | jsi::Object obj(runtime); 58 | obj.setProperty(runtime, "latitude", JSIConverter::toJSI(runtime, arg.latitude)); 59 | obj.setProperty(runtime, "longitude", JSIConverter::toJSI(runtime, arg.longitude)); 60 | return obj; 61 | } 62 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 63 | if (!value.isObject()) { 64 | return false; 65 | } 66 | jsi::Object obj = value.getObject(runtime); 67 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "latitude"))) return false; 68 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "longitude"))) return false; 69 | return true; 70 | } 71 | }; 72 | 73 | } // namespace margelo::nitro 74 | -------------------------------------------------------------------------------- /ios/PreviewCalendarInforView.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class PreviewCalendarInfoView: UIView { 4 | 5 | private let titleLabel: UILabel = { 6 | let label = UILabel() 7 | label.text = "Calendar" 8 | label.font = .systemFont(ofSize: 16, weight: .medium) 9 | label.textColor = .label 10 | label.translatesAutoresizingMaskIntoConstraints = false 11 | return label 12 | }() 13 | 14 | private let calendarLabel: UILabel = { 15 | let label = UILabel() 16 | label.textColor = .gray 17 | label.font = .systemFont(ofSize: 16) 18 | label.translatesAutoresizingMaskIntoConstraints = false 19 | return label 20 | }() 21 | 22 | private let calendarDot: UIView = { 23 | let view = UIView() 24 | view.layer.cornerRadius = 6 25 | view.translatesAutoresizingMaskIntoConstraints = false 26 | view.widthAnchor.constraint(equalToConstant: 12).isActive = true 27 | view.heightAnchor.constraint(equalToConstant: 12).isActive = true 28 | return view 29 | }() 30 | 31 | init(title: String, color: CGColor) { 32 | super.init(frame: .zero) 33 | configure(title: title, color: color) 34 | } 35 | 36 | required init?(coder: NSCoder) { 37 | fatalError("init(coder:) has not been implemented") 38 | } 39 | 40 | private func configure(title: String, color: CGColor) { 41 | calendarLabel.text = title 42 | calendarDot.backgroundColor = UIColor(cgColor: color) 43 | 44 | let spacerView = UIView() 45 | spacerView.setContentHuggingPriority(.defaultLow, for: .horizontal) 46 | 47 | let rightStackView = UIStackView(arrangedSubviews: [calendarDot, calendarLabel]) 48 | rightStackView.axis = .horizontal 49 | rightStackView.spacing = 6 50 | rightStackView.alignment = .center 51 | rightStackView.setContentHuggingPriority(.defaultHigh, for: .horizontal) 52 | rightStackView.translatesAutoresizingMaskIntoConstraints = false 53 | 54 | let mainStackView = UIStackView(arrangedSubviews: [titleLabel, spacerView, rightStackView]) 55 | mainStackView.axis = .horizontal 56 | mainStackView.alignment = .center 57 | mainStackView.translatesAutoresizingMaskIntoConstraints = false 58 | 59 | addSubview(mainStackView) 60 | 61 | NSLayoutConstraint.activate([ 62 | mainStackView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16), 63 | mainStackView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16), 64 | mainStackView.topAnchor.constraint(equalTo: topAnchor, constant: 10), 65 | mainStackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -10) 66 | ]) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitEntityMask.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitEntityMask.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | #include 24 | 25 | namespace margelo::nitro::eventkit { 26 | 27 | /** 28 | * A struct which can be represented as a JavaScript object (EventKitEntityMask). 29 | */ 30 | struct EventKitEntityMask { 31 | public: 32 | std::optional Event SWIFT_PRIVATE; 33 | std::optional Reminder SWIFT_PRIVATE; 34 | 35 | public: 36 | EventKitEntityMask() = default; 37 | explicit EventKitEntityMask(std::optional Event, std::optional Reminder): Event(Event), Reminder(Reminder) {} 38 | }; 39 | 40 | } // namespace margelo::nitro::eventkit 41 | 42 | namespace margelo::nitro { 43 | 44 | using namespace margelo::nitro::eventkit; 45 | 46 | // C++ EventKitEntityMask <> JS EventKitEntityMask (object) 47 | template <> 48 | struct JSIConverter final { 49 | static inline EventKitEntityMask fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 50 | jsi::Object obj = arg.asObject(runtime); 51 | return EventKitEntityMask( 52 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Event")), 53 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Reminder")) 54 | ); 55 | } 56 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitEntityMask& arg) { 57 | jsi::Object obj(runtime); 58 | obj.setProperty(runtime, "Event", JSIConverter>::toJSI(runtime, arg.Event)); 59 | obj.setProperty(runtime, "Reminder", JSIConverter>::toJSI(runtime, arg.Reminder)); 60 | return obj; 61 | } 62 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 63 | if (!value.isObject()) { 64 | return false; 65 | } 66 | jsi::Object obj = value.getObject(runtime); 67 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Event"))) return false; 68 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Reminder"))) return false; 69 | return true; 70 | } 71 | }; 72 | 73 | } // namespace margelo::nitro 74 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitStructuredLocation.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitStructuredLocation.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitStructuredLocation`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitStructuredLocation = margelo.nitro.eventkit.EventKitStructuredLocation 14 | 15 | public extension EventKitStructuredLocation { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitStructuredLocation`. 20 | */ 21 | init(title: String?, geoLocation: EventKitGeoLocation?, radius: Double) { 22 | self.init({ () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = title { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }(), { () -> bridge.std__optional_EventKitGeoLocation_ in 29 | if let __unwrappedValue = geoLocation { 30 | return bridge.create_std__optional_EventKitGeoLocation_(__unwrappedValue) 31 | } else { 32 | return .init() 33 | } 34 | }(), radius) 35 | } 36 | 37 | var title: String? { 38 | @inline(__always) 39 | get { 40 | return { () -> String? in 41 | if let __unwrapped = self.__title.value { 42 | return String(__unwrapped) 43 | } else { 44 | return nil 45 | } 46 | }() 47 | } 48 | @inline(__always) 49 | set { 50 | self.__title = { () -> bridge.std__optional_std__string_ in 51 | if let __unwrappedValue = newValue { 52 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 53 | } else { 54 | return .init() 55 | } 56 | }() 57 | } 58 | } 59 | 60 | var geoLocation: EventKitGeoLocation? { 61 | @inline(__always) 62 | get { 63 | return { () -> EventKitGeoLocation? in 64 | if let __unwrapped = self.__geoLocation.value { 65 | return __unwrapped 66 | } else { 67 | return nil 68 | } 69 | }() 70 | } 71 | @inline(__always) 72 | set { 73 | self.__geoLocation = { () -> bridge.std__optional_EventKitGeoLocation_ in 74 | if let __unwrappedValue = newValue { 75 | return bridge.create_std__optional_EventKitGeoLocation_(__unwrappedValue) 76 | } else { 77 | return .init() 78 | } 79 | }() 80 | } 81 | } 82 | 83 | var radius: Double { 84 | @inline(__always) 85 | get { 86 | return self.__radius 87 | } 88 | @inline(__always) 89 | set { 90 | self.__radius = newValue 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/CreateCalendarOptions.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// CreateCalendarOptions.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `CreateCalendarOptions`, backed by a C++ struct. 12 | */ 13 | public typealias CreateCalendarOptions = margelo.nitro.eventkit.CreateCalendarOptions 14 | 15 | public extension CreateCalendarOptions { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `CreateCalendarOptions`. 20 | */ 21 | init(name: String, cgColor: String?, entityType: EventKitEntityType, sourceType: EventKitSourceType?) { 22 | self.init(std.string(name), { () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = cgColor { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }(), entityType, { () -> bridge.std__optional_EventKitSourceType_ in 29 | if let __unwrappedValue = sourceType { 30 | return bridge.create_std__optional_EventKitSourceType_(__unwrappedValue) 31 | } else { 32 | return .init() 33 | } 34 | }()) 35 | } 36 | 37 | var name: String { 38 | @inline(__always) 39 | get { 40 | return String(self.__name) 41 | } 42 | @inline(__always) 43 | set { 44 | self.__name = std.string(newValue) 45 | } 46 | } 47 | 48 | var cgColor: String? { 49 | @inline(__always) 50 | get { 51 | return { () -> String? in 52 | if let __unwrapped = self.__cgColor.value { 53 | return String(__unwrapped) 54 | } else { 55 | return nil 56 | } 57 | }() 58 | } 59 | @inline(__always) 60 | set { 61 | self.__cgColor = { () -> bridge.std__optional_std__string_ in 62 | if let __unwrappedValue = newValue { 63 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 64 | } else { 65 | return .init() 66 | } 67 | }() 68 | } 69 | } 70 | 71 | var entityType: EventKitEntityType { 72 | @inline(__always) 73 | get { 74 | return self.__entityType 75 | } 76 | @inline(__always) 77 | set { 78 | self.__entityType = newValue 79 | } 80 | } 81 | 82 | var sourceType: EventKitSourceType? { 83 | @inline(__always) 84 | get { 85 | return self.__sourceType.has_value() ? self.__sourceType.pointee : nil 86 | } 87 | @inline(__always) 88 | set { 89 | self.__sourceType = { () -> bridge.std__optional_EventKitSourceType_ in 90 | if let __unwrappedValue = newValue { 91 | return bridge.create_std__optional_EventKitSourceType_(__unwrappedValue) 92 | } else { 93 | return .init() 94 | } 95 | }() 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/c++/HybridCalendarPermissionSpecSwift.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridCalendarPermissionSpecSwift.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #include "HybridCalendarPermissionSpec.hpp" 11 | 12 | // Forward declaration of `HybridCalendarPermissionSpec_cxx` to properly resolve imports. 13 | namespace NitroEventKit { class HybridCalendarPermissionSpec_cxx; } 14 | 15 | // Forward declaration of `EventKitPermissionResult` to properly resolve imports. 16 | namespace margelo::nitro::eventkit { enum class EventKitPermissionResult; } 17 | 18 | #include "EventKitPermissionResult.hpp" 19 | #include 20 | 21 | #include "NitroEventKit-Swift-Cxx-Umbrella.hpp" 22 | 23 | namespace margelo::nitro::eventkit { 24 | 25 | /** 26 | * The C++ part of HybridCalendarPermissionSpec_cxx.swift. 27 | * 28 | * HybridCalendarPermissionSpecSwift (C++) accesses HybridCalendarPermissionSpec_cxx (Swift), and might 29 | * contain some additional bridging code for C++ <> Swift interop. 30 | * 31 | * Since this obviously introduces an overhead, I hope at some point in 32 | * the future, HybridCalendarPermissionSpec_cxx can directly inherit from the C++ class HybridCalendarPermissionSpec 33 | * to simplify the whole structure and memory management. 34 | */ 35 | class HybridCalendarPermissionSpecSwift: public virtual HybridCalendarPermissionSpec { 36 | public: 37 | // Constructor from a Swift instance 38 | explicit HybridCalendarPermissionSpecSwift(const NitroEventKit::HybridCalendarPermissionSpec_cxx& swiftPart): 39 | HybridObject(HybridCalendarPermissionSpec::TAG), 40 | _swiftPart(swiftPart) { } 41 | 42 | public: 43 | // Get the Swift part 44 | inline NitroEventKit::HybridCalendarPermissionSpec_cxx& getSwiftPart() noexcept { 45 | return _swiftPart; 46 | } 47 | 48 | public: 49 | // Get memory pressure 50 | inline size_t getExternalMemorySize() noexcept override { 51 | return _swiftPart.getMemorySize(); 52 | } 53 | 54 | public: 55 | // Properties 56 | 57 | 58 | public: 59 | // Methods 60 | inline EventKitPermissionResult getPermissionsStatus() override { 61 | auto __result = _swiftPart.getPermissionsStatus(); 62 | if (__result.hasError()) [[unlikely]] { 63 | std::rethrow_exception(__result.error()); 64 | } 65 | auto __value = std::move(__result.value()); 66 | return __value; 67 | } 68 | inline std::shared_ptr> requestPermission() override { 69 | auto __result = _swiftPart.requestPermission(); 70 | if (__result.hasError()) [[unlikely]] { 71 | std::rethrow_exception(__result.error()); 72 | } 73 | auto __value = std::move(__result.value()); 74 | return __value; 75 | } 76 | 77 | private: 78 | NitroEventKit::HybridCalendarPermissionSpec_cxx _swiftPart; 79 | }; 80 | 81 | } // namespace margelo::nitro::eventkit 82 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EditEventLocation.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EditEventLocation.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EditEventLocation`, backed by a C++ struct. 12 | */ 13 | public typealias EditEventLocation = margelo.nitro.eventkit.EditEventLocation 14 | 15 | public extension EditEventLocation { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EditEventLocation`. 20 | */ 21 | init(title: String?, latitude: Double?, longitude: Double?) { 22 | self.init({ () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = title { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }(), { () -> bridge.std__optional_double_ in 29 | if let __unwrappedValue = latitude { 30 | return bridge.create_std__optional_double_(__unwrappedValue) 31 | } else { 32 | return .init() 33 | } 34 | }(), { () -> bridge.std__optional_double_ in 35 | if let __unwrappedValue = longitude { 36 | return bridge.create_std__optional_double_(__unwrappedValue) 37 | } else { 38 | return .init() 39 | } 40 | }()) 41 | } 42 | 43 | var title: String? { 44 | @inline(__always) 45 | get { 46 | return { () -> String? in 47 | if let __unwrapped = self.__title.value { 48 | return String(__unwrapped) 49 | } else { 50 | return nil 51 | } 52 | }() 53 | } 54 | @inline(__always) 55 | set { 56 | self.__title = { () -> bridge.std__optional_std__string_ in 57 | if let __unwrappedValue = newValue { 58 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 59 | } else { 60 | return .init() 61 | } 62 | }() 63 | } 64 | } 65 | 66 | var latitude: Double? { 67 | @inline(__always) 68 | get { 69 | return self.__latitude.value 70 | } 71 | @inline(__always) 72 | set { 73 | self.__latitude = { () -> bridge.std__optional_double_ in 74 | if let __unwrappedValue = newValue { 75 | return bridge.create_std__optional_double_(__unwrappedValue) 76 | } else { 77 | return .init() 78 | } 79 | }() 80 | } 81 | } 82 | 83 | var longitude: Double? { 84 | @inline(__always) 85 | get { 86 | return self.__longitude.value 87 | } 88 | @inline(__always) 89 | set { 90 | self.__longitude = { () -> bridge.std__optional_double_ in 91 | if let __unwrappedValue = newValue { 92 | return bridge.create_std__optional_double_(__unwrappedValue) 93 | } else { 94 | return .init() 95 | } 96 | }() 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/MonthlyEventOptions.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// MonthlyEventOptions.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | // Forward declaration of `EventKitEntityType` to properly resolve imports. 22 | namespace margelo::nitro::eventkit { enum class EventKitEntityType; } 23 | 24 | #include "EventKitEntityType.hpp" 25 | #include 26 | #include 27 | 28 | namespace margelo::nitro::eventkit { 29 | 30 | /** 31 | * A struct which can be represented as a JavaScript object (MonthlyEventOptions). 32 | */ 33 | struct MonthlyEventOptions { 34 | public: 35 | EventKitEntityType entityType SWIFT_PRIVATE; 36 | std::optional calendarId SWIFT_PRIVATE; 37 | 38 | public: 39 | MonthlyEventOptions() = default; 40 | explicit MonthlyEventOptions(EventKitEntityType entityType, std::optional calendarId): entityType(entityType), calendarId(calendarId) {} 41 | }; 42 | 43 | } // namespace margelo::nitro::eventkit 44 | 45 | namespace margelo::nitro { 46 | 47 | using namespace margelo::nitro::eventkit; 48 | 49 | // C++ MonthlyEventOptions <> JS MonthlyEventOptions (object) 50 | template <> 51 | struct JSIConverter final { 52 | static inline MonthlyEventOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 53 | jsi::Object obj = arg.asObject(runtime); 54 | return MonthlyEventOptions( 55 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "entityType")), 56 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "calendarId")) 57 | ); 58 | } 59 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const MonthlyEventOptions& arg) { 60 | jsi::Object obj(runtime); 61 | obj.setProperty(runtime, "entityType", JSIConverter::toJSI(runtime, arg.entityType)); 62 | obj.setProperty(runtime, "calendarId", JSIConverter>::toJSI(runtime, arg.calendarId)); 63 | return obj; 64 | } 65 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 66 | if (!value.isObject()) { 67 | return false; 68 | } 69 | jsi::Object obj = value.getObject(runtime); 70 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "entityType"))) return false; 71 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "calendarId"))) return false; 72 | return true; 73 | } 74 | }; 75 | 76 | } // namespace margelo::nitro 77 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/CreateEventLocation.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// CreateEventLocation.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | #include 24 | #include 25 | 26 | namespace margelo::nitro::eventkit { 27 | 28 | /** 29 | * A struct which can be represented as a JavaScript object (CreateEventLocation). 30 | */ 31 | struct CreateEventLocation { 32 | public: 33 | std::optional title SWIFT_PRIVATE; 34 | double latitude SWIFT_PRIVATE; 35 | double longitude SWIFT_PRIVATE; 36 | 37 | public: 38 | CreateEventLocation() = default; 39 | explicit CreateEventLocation(std::optional title, double latitude, double longitude): title(title), latitude(latitude), longitude(longitude) {} 40 | }; 41 | 42 | } // namespace margelo::nitro::eventkit 43 | 44 | namespace margelo::nitro { 45 | 46 | using namespace margelo::nitro::eventkit; 47 | 48 | // C++ CreateEventLocation <> JS CreateEventLocation (object) 49 | template <> 50 | struct JSIConverter final { 51 | static inline CreateEventLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 52 | jsi::Object obj = arg.asObject(runtime); 53 | return CreateEventLocation( 54 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "title")), 55 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "latitude")), 56 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "longitude")) 57 | ); 58 | } 59 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const CreateEventLocation& arg) { 60 | jsi::Object obj(runtime); 61 | obj.setProperty(runtime, "title", JSIConverter>::toJSI(runtime, arg.title)); 62 | obj.setProperty(runtime, "latitude", JSIConverter::toJSI(runtime, arg.latitude)); 63 | obj.setProperty(runtime, "longitude", JSIConverter::toJSI(runtime, arg.longitude)); 64 | return obj; 65 | } 66 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 67 | if (!value.isObject()) { 68 | return false; 69 | } 70 | jsi::Object obj = value.getObject(runtime); 71 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false; 72 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "latitude"))) return false; 73 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "longitude"))) return false; 74 | return true; 75 | } 76 | }; 77 | 78 | } // namespace margelo::nitro 79 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EditEventLocation.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EditEventLocation.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | #include 24 | #include 25 | 26 | namespace margelo::nitro::eventkit { 27 | 28 | /** 29 | * A struct which can be represented as a JavaScript object (EditEventLocation). 30 | */ 31 | struct EditEventLocation { 32 | public: 33 | std::optional title SWIFT_PRIVATE; 34 | std::optional latitude SWIFT_PRIVATE; 35 | std::optional longitude SWIFT_PRIVATE; 36 | 37 | public: 38 | EditEventLocation() = default; 39 | explicit EditEventLocation(std::optional title, std::optional latitude, std::optional longitude): title(title), latitude(latitude), longitude(longitude) {} 40 | }; 41 | 42 | } // namespace margelo::nitro::eventkit 43 | 44 | namespace margelo::nitro { 45 | 46 | using namespace margelo::nitro::eventkit; 47 | 48 | // C++ EditEventLocation <> JS EditEventLocation (object) 49 | template <> 50 | struct JSIConverter final { 51 | static inline EditEventLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 52 | jsi::Object obj = arg.asObject(runtime); 53 | return EditEventLocation( 54 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "title")), 55 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "latitude")), 56 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "longitude")) 57 | ); 58 | } 59 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EditEventLocation& arg) { 60 | jsi::Object obj(runtime); 61 | obj.setProperty(runtime, "title", JSIConverter>::toJSI(runtime, arg.title)); 62 | obj.setProperty(runtime, "latitude", JSIConverter>::toJSI(runtime, arg.latitude)); 63 | obj.setProperty(runtime, "longitude", JSIConverter>::toJSI(runtime, arg.longitude)); 64 | return obj; 65 | } 66 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 67 | if (!value.isObject()) { 68 | return false; 69 | } 70 | jsi::Object obj = value.getObject(runtime); 71 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false; 72 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "latitude"))) return false; 73 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "longitude"))) return false; 74 | return true; 75 | } 76 | }; 77 | 78 | } // namespace margelo::nitro 79 | -------------------------------------------------------------------------------- /example/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.7) 5 | base64 6 | nkf 7 | rexml 8 | activesupport (7.2.2.1) 9 | base64 10 | benchmark (>= 0.3) 11 | bigdecimal 12 | concurrent-ruby (~> 1.0, >= 1.3.1) 13 | connection_pool (>= 2.2.5) 14 | drb 15 | i18n (>= 1.6, < 2) 16 | logger (>= 1.4.2) 17 | minitest (>= 5.1) 18 | securerandom (>= 0.3) 19 | tzinfo (~> 2.0, >= 2.0.5) 20 | addressable (2.8.7) 21 | public_suffix (>= 2.0.2, < 7.0) 22 | algoliasearch (1.27.5) 23 | httpclient (~> 2.8, >= 2.8.3) 24 | json (>= 1.5.1) 25 | atomos (0.1.3) 26 | base64 (0.2.0) 27 | benchmark (0.4.0) 28 | bigdecimal (3.1.9) 29 | claide (1.1.0) 30 | cocoapods (1.15.2) 31 | addressable (~> 2.8) 32 | claide (>= 1.0.2, < 2.0) 33 | cocoapods-core (= 1.15.2) 34 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 35 | cocoapods-downloader (>= 2.1, < 3.0) 36 | cocoapods-plugins (>= 1.0.0, < 2.0) 37 | cocoapods-search (>= 1.0.0, < 2.0) 38 | cocoapods-trunk (>= 1.6.0, < 2.0) 39 | cocoapods-try (>= 1.1.0, < 2.0) 40 | colored2 (~> 3.1) 41 | escape (~> 0.0.4) 42 | fourflusher (>= 2.3.0, < 3.0) 43 | gh_inspector (~> 1.0) 44 | molinillo (~> 0.8.0) 45 | nap (~> 1.0) 46 | ruby-macho (>= 2.3.0, < 3.0) 47 | xcodeproj (>= 1.23.0, < 2.0) 48 | cocoapods-core (1.15.2) 49 | activesupport (>= 5.0, < 8) 50 | addressable (~> 2.8) 51 | algoliasearch (~> 1.0) 52 | concurrent-ruby (~> 1.1) 53 | fuzzy_match (~> 2.0.4) 54 | nap (~> 1.0) 55 | netrc (~> 0.11) 56 | public_suffix (~> 4.0) 57 | typhoeus (~> 1.0) 58 | cocoapods-deintegrate (1.0.5) 59 | cocoapods-downloader (2.1) 60 | cocoapods-plugins (1.0.0) 61 | nap 62 | cocoapods-search (1.0.1) 63 | cocoapods-trunk (1.6.0) 64 | nap (>= 0.8, < 2.0) 65 | netrc (~> 0.11) 66 | cocoapods-try (1.2.0) 67 | colored2 (3.1.2) 68 | concurrent-ruby (1.3.3) 69 | connection_pool (2.5.0) 70 | drb (2.2.1) 71 | escape (0.0.4) 72 | ethon (0.16.0) 73 | ffi (>= 1.15.0) 74 | ffi (1.17.1) 75 | fourflusher (2.3.1) 76 | fuzzy_match (2.0.4) 77 | gh_inspector (1.1.3) 78 | httpclient (2.8.3) 79 | i18n (1.14.7) 80 | concurrent-ruby (~> 1.0) 81 | json (2.9.1) 82 | logger (1.6.5) 83 | minitest (5.25.4) 84 | molinillo (0.8.0) 85 | nanaimo (0.3.0) 86 | nap (1.1.0) 87 | netrc (0.11.0) 88 | nkf (0.2.0) 89 | public_suffix (4.0.7) 90 | rexml (3.4.0) 91 | ruby-macho (2.5.1) 92 | securerandom (0.4.1) 93 | typhoeus (1.4.1) 94 | ethon (>= 0.9.0) 95 | tzinfo (2.0.6) 96 | concurrent-ruby (~> 1.0) 97 | xcodeproj (1.25.1) 98 | CFPropertyList (>= 2.3.3, < 4.0) 99 | atomos (~> 0.1.3) 100 | claide (>= 1.0.2, < 2.0) 101 | colored2 (~> 3.1) 102 | nanaimo (~> 0.3.0) 103 | rexml (>= 3.3.6, < 4.0) 104 | 105 | PLATFORMS 106 | ruby 107 | 108 | DEPENDENCIES 109 | activesupport (>= 6.1.7.5, != 7.1.0) 110 | cocoapods (>= 1.13, != 1.15.1, != 1.15.0) 111 | concurrent-ruby (< 1.3.4) 112 | xcodeproj (< 1.26.0) 113 | 114 | RUBY VERSION 115 | ruby 3.1.2p20 116 | 117 | BUNDLED WITH 118 | 2.3.7 119 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitParticipant.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitParticipant.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitParticipant`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitParticipant = margelo.nitro.eventkit.EventKitParticipant 14 | 15 | public extension EventKitParticipant { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitParticipant`. 20 | */ 21 | init(url: String, name: String?, participantStatus: EventKitParticipantStatus, participantRole: EventKitParticipantRole, participantType: EventKitParticipantType, isCurrentUser: Bool, contactPredicate: EventKitPredicate) { 22 | self.init(std.string(url), { () -> bridge.std__optional_std__string_ in 23 | if let __unwrappedValue = name { 24 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 25 | } else { 26 | return .init() 27 | } 28 | }(), participantStatus, participantRole, participantType, isCurrentUser, contactPredicate) 29 | } 30 | 31 | var url: String { 32 | @inline(__always) 33 | get { 34 | return String(self.__url) 35 | } 36 | @inline(__always) 37 | set { 38 | self.__url = std.string(newValue) 39 | } 40 | } 41 | 42 | var name: String? { 43 | @inline(__always) 44 | get { 45 | return { () -> String? in 46 | if let __unwrapped = self.__name.value { 47 | return String(__unwrapped) 48 | } else { 49 | return nil 50 | } 51 | }() 52 | } 53 | @inline(__always) 54 | set { 55 | self.__name = { () -> bridge.std__optional_std__string_ in 56 | if let __unwrappedValue = newValue { 57 | return bridge.create_std__optional_std__string_(std.string(__unwrappedValue)) 58 | } else { 59 | return .init() 60 | } 61 | }() 62 | } 63 | } 64 | 65 | var participantStatus: EventKitParticipantStatus { 66 | @inline(__always) 67 | get { 68 | return self.__participantStatus 69 | } 70 | @inline(__always) 71 | set { 72 | self.__participantStatus = newValue 73 | } 74 | } 75 | 76 | var participantRole: EventKitParticipantRole { 77 | @inline(__always) 78 | get { 79 | return self.__participantRole 80 | } 81 | @inline(__always) 82 | set { 83 | self.__participantRole = newValue 84 | } 85 | } 86 | 87 | var participantType: EventKitParticipantType { 88 | @inline(__always) 89 | get { 90 | return self.__participantType 91 | } 92 | @inline(__always) 93 | set { 94 | self.__participantType = newValue 95 | } 96 | } 97 | 98 | var isCurrentUser: Bool { 99 | @inline(__always) 100 | get { 101 | return self.__isCurrentUser 102 | } 103 | @inline(__always) 104 | set { 105 | self.__isCurrentUser = newValue 106 | } 107 | } 108 | 109 | var contactPredicate: EventKitPredicate { 110 | @inline(__always) 111 | get { 112 | return self.__contactPredicate 113 | } 114 | @inline(__always) 115 | set { 116 | self.__contactPredicate = newValue 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitGeoLocation.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitGeoLocation.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitGeoLocation`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitGeoLocation = margelo.nitro.eventkit.EventKitGeoLocation 14 | 15 | public extension EventKitGeoLocation { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitGeoLocation`. 20 | */ 21 | init(coordinate: EventKitCoordinate, altitude: Double, ellipsoidalAltitude: Double, horizontalAccuracy: Double, verticalAccuracy: Double, course: Double, courseAccuracy: Double, speed: Double, speedAccuracy: Double, timestamp: Double) { 22 | self.init(coordinate, altitude, ellipsoidalAltitude, horizontalAccuracy, verticalAccuracy, course, courseAccuracy, speed, speedAccuracy, timestamp) 23 | } 24 | 25 | var coordinate: EventKitCoordinate { 26 | @inline(__always) 27 | get { 28 | return self.__coordinate 29 | } 30 | @inline(__always) 31 | set { 32 | self.__coordinate = newValue 33 | } 34 | } 35 | 36 | var altitude: Double { 37 | @inline(__always) 38 | get { 39 | return self.__altitude 40 | } 41 | @inline(__always) 42 | set { 43 | self.__altitude = newValue 44 | } 45 | } 46 | 47 | var ellipsoidalAltitude: Double { 48 | @inline(__always) 49 | get { 50 | return self.__ellipsoidalAltitude 51 | } 52 | @inline(__always) 53 | set { 54 | self.__ellipsoidalAltitude = newValue 55 | } 56 | } 57 | 58 | var horizontalAccuracy: Double { 59 | @inline(__always) 60 | get { 61 | return self.__horizontalAccuracy 62 | } 63 | @inline(__always) 64 | set { 65 | self.__horizontalAccuracy = newValue 66 | } 67 | } 68 | 69 | var verticalAccuracy: Double { 70 | @inline(__always) 71 | get { 72 | return self.__verticalAccuracy 73 | } 74 | @inline(__always) 75 | set { 76 | self.__verticalAccuracy = newValue 77 | } 78 | } 79 | 80 | var course: Double { 81 | @inline(__always) 82 | get { 83 | return self.__course 84 | } 85 | @inline(__always) 86 | set { 87 | self.__course = newValue 88 | } 89 | } 90 | 91 | var courseAccuracy: Double { 92 | @inline(__always) 93 | get { 94 | return self.__courseAccuracy 95 | } 96 | @inline(__always) 97 | set { 98 | self.__courseAccuracy = newValue 99 | } 100 | } 101 | 102 | var speed: Double { 103 | @inline(__always) 104 | get { 105 | return self.__speed 106 | } 107 | @inline(__always) 108 | set { 109 | self.__speed = newValue 110 | } 111 | } 112 | 113 | var speedAccuracy: Double { 114 | @inline(__always) 115 | get { 116 | return self.__speedAccuracy 117 | } 118 | @inline(__always) 119 | set { 120 | self.__speedAccuracy = newValue 121 | } 122 | } 123 | 124 | var timestamp: Double { 125 | @inline(__always) 126 | get { 127 | return self.__timestamp 128 | } 129 | @inline(__always) 130 | set { 131 | self.__timestamp = newValue 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitStructuredLocation.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitStructuredLocation.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | // Forward declaration of `EventKitGeoLocation` to properly resolve imports. 22 | namespace margelo::nitro::eventkit { struct EventKitGeoLocation; } 23 | 24 | #include 25 | #include 26 | #include "EventKitGeoLocation.hpp" 27 | 28 | namespace margelo::nitro::eventkit { 29 | 30 | /** 31 | * A struct which can be represented as a JavaScript object (EventKitStructuredLocation). 32 | */ 33 | struct EventKitStructuredLocation { 34 | public: 35 | std::optional title SWIFT_PRIVATE; 36 | std::optional geoLocation SWIFT_PRIVATE; 37 | double radius SWIFT_PRIVATE; 38 | 39 | public: 40 | EventKitStructuredLocation() = default; 41 | explicit EventKitStructuredLocation(std::optional title, std::optional geoLocation, double radius): title(title), geoLocation(geoLocation), radius(radius) {} 42 | }; 43 | 44 | } // namespace margelo::nitro::eventkit 45 | 46 | namespace margelo::nitro { 47 | 48 | using namespace margelo::nitro::eventkit; 49 | 50 | // C++ EventKitStructuredLocation <> JS EventKitStructuredLocation (object) 51 | template <> 52 | struct JSIConverter final { 53 | static inline EventKitStructuredLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 54 | jsi::Object obj = arg.asObject(runtime); 55 | return EventKitStructuredLocation( 56 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "title")), 57 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "geoLocation")), 58 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "radius")) 59 | ); 60 | } 61 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitStructuredLocation& arg) { 62 | jsi::Object obj(runtime); 63 | obj.setProperty(runtime, "title", JSIConverter>::toJSI(runtime, arg.title)); 64 | obj.setProperty(runtime, "geoLocation", JSIConverter>::toJSI(runtime, arg.geoLocation)); 65 | obj.setProperty(runtime, "radius", JSIConverter::toJSI(runtime, arg.radius)); 66 | return obj; 67 | } 68 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 69 | if (!value.isObject()) { 70 | return false; 71 | } 72 | jsi::Object obj = value.getObject(runtime); 73 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false; 74 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "geoLocation"))) return false; 75 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "radius"))) return false; 76 | return true; 77 | } 78 | }; 79 | 80 | } // namespace margelo::nitro 81 | -------------------------------------------------------------------------------- /example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /nitrogen/generated/ios/swift/EventKitCalendarEventAvailabilityMask.swift: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCalendarEventAvailabilityMask.swift 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | import NitroModules 9 | 10 | /** 11 | * Represents an instance of `EventKitCalendarEventAvailabilityMask`, backed by a C++ struct. 12 | */ 13 | public typealias EventKitCalendarEventAvailabilityMask = margelo.nitro.eventkit.EventKitCalendarEventAvailabilityMask 14 | 15 | public extension EventKitCalendarEventAvailabilityMask { 16 | private typealias bridge = margelo.nitro.eventkit.bridge.swift 17 | 18 | /** 19 | * Create a new instance of `EventKitCalendarEventAvailabilityMask`. 20 | */ 21 | init(Busy: Bool?, Free: Bool?, Tentative: Bool?, Unavailable: Bool?) { 22 | self.init({ () -> bridge.std__optional_bool_ in 23 | if let __unwrappedValue = Busy { 24 | return bridge.create_std__optional_bool_(__unwrappedValue) 25 | } else { 26 | return .init() 27 | } 28 | }(), { () -> bridge.std__optional_bool_ in 29 | if let __unwrappedValue = Free { 30 | return bridge.create_std__optional_bool_(__unwrappedValue) 31 | } else { 32 | return .init() 33 | } 34 | }(), { () -> bridge.std__optional_bool_ in 35 | if let __unwrappedValue = Tentative { 36 | return bridge.create_std__optional_bool_(__unwrappedValue) 37 | } else { 38 | return .init() 39 | } 40 | }(), { () -> bridge.std__optional_bool_ in 41 | if let __unwrappedValue = Unavailable { 42 | return bridge.create_std__optional_bool_(__unwrappedValue) 43 | } else { 44 | return .init() 45 | } 46 | }()) 47 | } 48 | 49 | var Busy: Bool? { 50 | @inline(__always) 51 | get { 52 | return self.__Busy.value 53 | } 54 | @inline(__always) 55 | set { 56 | self.__Busy = { () -> bridge.std__optional_bool_ in 57 | if let __unwrappedValue = newValue { 58 | return bridge.create_std__optional_bool_(__unwrappedValue) 59 | } else { 60 | return .init() 61 | } 62 | }() 63 | } 64 | } 65 | 66 | var Free: Bool? { 67 | @inline(__always) 68 | get { 69 | return self.__Free.value 70 | } 71 | @inline(__always) 72 | set { 73 | self.__Free = { () -> bridge.std__optional_bool_ in 74 | if let __unwrappedValue = newValue { 75 | return bridge.create_std__optional_bool_(__unwrappedValue) 76 | } else { 77 | return .init() 78 | } 79 | }() 80 | } 81 | } 82 | 83 | var Tentative: Bool? { 84 | @inline(__always) 85 | get { 86 | return self.__Tentative.value 87 | } 88 | @inline(__always) 89 | set { 90 | self.__Tentative = { () -> bridge.std__optional_bool_ in 91 | if let __unwrappedValue = newValue { 92 | return bridge.create_std__optional_bool_(__unwrappedValue) 93 | } else { 94 | return .init() 95 | } 96 | }() 97 | } 98 | } 99 | 100 | var Unavailable: Bool? { 101 | @inline(__always) 102 | get { 103 | return self.__Unavailable.value 104 | } 105 | @inline(__always) 106 | set { 107 | self.__Unavailable = { () -> bridge.std__optional_bool_ in 108 | if let __unwrappedValue = newValue { 109 | return bridge.create_std__optional_bool_(__unwrappedValue) 110 | } else { 111 | return .init() 112 | } 113 | }() 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/RangeEventOptions.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// RangeEventOptions.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | // Forward declaration of `EventKitEntityType` to properly resolve imports. 22 | namespace margelo::nitro::eventkit { enum class EventKitEntityType; } 23 | 24 | #include "EventKitEntityType.hpp" 25 | #include 26 | #include 27 | 28 | namespace margelo::nitro::eventkit { 29 | 30 | /** 31 | * A struct which can be represented as a JavaScript object (RangeEventOptions). 32 | */ 33 | struct RangeEventOptions { 34 | public: 35 | double startDate SWIFT_PRIVATE; 36 | double endDate SWIFT_PRIVATE; 37 | EventKitEntityType entityType SWIFT_PRIVATE; 38 | std::optional calendarId SWIFT_PRIVATE; 39 | 40 | public: 41 | RangeEventOptions() = default; 42 | explicit RangeEventOptions(double startDate, double endDate, EventKitEntityType entityType, std::optional calendarId): startDate(startDate), endDate(endDate), entityType(entityType), calendarId(calendarId) {} 43 | }; 44 | 45 | } // namespace margelo::nitro::eventkit 46 | 47 | namespace margelo::nitro { 48 | 49 | using namespace margelo::nitro::eventkit; 50 | 51 | // C++ RangeEventOptions <> JS RangeEventOptions (object) 52 | template <> 53 | struct JSIConverter final { 54 | static inline RangeEventOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 55 | jsi::Object obj = arg.asObject(runtime); 56 | return RangeEventOptions( 57 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "startDate")), 58 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "endDate")), 59 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "entityType")), 60 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "calendarId")) 61 | ); 62 | } 63 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const RangeEventOptions& arg) { 64 | jsi::Object obj(runtime); 65 | obj.setProperty(runtime, "startDate", JSIConverter::toJSI(runtime, arg.startDate)); 66 | obj.setProperty(runtime, "endDate", JSIConverter::toJSI(runtime, arg.endDate)); 67 | obj.setProperty(runtime, "entityType", JSIConverter::toJSI(runtime, arg.entityType)); 68 | obj.setProperty(runtime, "calendarId", JSIConverter>::toJSI(runtime, arg.calendarId)); 69 | return obj; 70 | } 71 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 72 | if (!value.isObject()) { 73 | return false; 74 | } 75 | jsi::Object obj = value.getObject(runtime); 76 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false; 77 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false; 78 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "entityType"))) return false; 79 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "calendarId"))) return false; 80 | return true; 81 | } 82 | }; 83 | 84 | } // namespace margelo::nitro 85 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitSource.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitSource.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | // Forward declaration of `EventKitSourceType` to properly resolve imports. 22 | namespace margelo::nitro::eventkit { enum class EventKitSourceType; } 23 | 24 | #include 25 | #include "EventKitSourceType.hpp" 26 | #include 27 | 28 | namespace margelo::nitro::eventkit { 29 | 30 | /** 31 | * A struct which can be represented as a JavaScript object (EventKitSource). 32 | */ 33 | struct EventKitSource { 34 | public: 35 | std::string sourceIdentifier SWIFT_PRIVATE; 36 | EventKitSourceType sourceType SWIFT_PRIVATE; 37 | std::string title SWIFT_PRIVATE; 38 | std::optional isDelegate SWIFT_PRIVATE; 39 | 40 | public: 41 | EventKitSource() = default; 42 | explicit EventKitSource(std::string sourceIdentifier, EventKitSourceType sourceType, std::string title, std::optional isDelegate): sourceIdentifier(sourceIdentifier), sourceType(sourceType), title(title), isDelegate(isDelegate) {} 43 | }; 44 | 45 | } // namespace margelo::nitro::eventkit 46 | 47 | namespace margelo::nitro { 48 | 49 | using namespace margelo::nitro::eventkit; 50 | 51 | // C++ EventKitSource <> JS EventKitSource (object) 52 | template <> 53 | struct JSIConverter final { 54 | static inline EventKitSource fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 55 | jsi::Object obj = arg.asObject(runtime); 56 | return EventKitSource( 57 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "sourceIdentifier")), 58 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "sourceType")), 59 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "title")), 60 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "isDelegate")) 61 | ); 62 | } 63 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitSource& arg) { 64 | jsi::Object obj(runtime); 65 | obj.setProperty(runtime, "sourceIdentifier", JSIConverter::toJSI(runtime, arg.sourceIdentifier)); 66 | obj.setProperty(runtime, "sourceType", JSIConverter::toJSI(runtime, arg.sourceType)); 67 | obj.setProperty(runtime, "title", JSIConverter::toJSI(runtime, arg.title)); 68 | obj.setProperty(runtime, "isDelegate", JSIConverter>::toJSI(runtime, arg.isDelegate)); 69 | return obj; 70 | } 71 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 72 | if (!value.isObject()) { 73 | return false; 74 | } 75 | jsi::Object obj = value.getObject(runtime); 76 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "sourceIdentifier"))) return false; 77 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "sourceType"))) return false; 78 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "title"))) return false; 79 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "isDelegate"))) return false; 80 | return true; 81 | } 82 | }; 83 | 84 | } // namespace margelo::nitro 85 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/EventKitCalendarEventAvailabilityMask.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// EventKitCalendarEventAvailabilityMask.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | 22 | 23 | #include 24 | 25 | namespace margelo::nitro::eventkit { 26 | 27 | /** 28 | * A struct which can be represented as a JavaScript object (EventKitCalendarEventAvailabilityMask). 29 | */ 30 | struct EventKitCalendarEventAvailabilityMask { 31 | public: 32 | std::optional Busy SWIFT_PRIVATE; 33 | std::optional Free SWIFT_PRIVATE; 34 | std::optional Tentative SWIFT_PRIVATE; 35 | std::optional Unavailable SWIFT_PRIVATE; 36 | 37 | public: 38 | EventKitCalendarEventAvailabilityMask() = default; 39 | explicit EventKitCalendarEventAvailabilityMask(std::optional Busy, std::optional Free, std::optional Tentative, std::optional Unavailable): Busy(Busy), Free(Free), Tentative(Tentative), Unavailable(Unavailable) {} 40 | }; 41 | 42 | } // namespace margelo::nitro::eventkit 43 | 44 | namespace margelo::nitro { 45 | 46 | using namespace margelo::nitro::eventkit; 47 | 48 | // C++ EventKitCalendarEventAvailabilityMask <> JS EventKitCalendarEventAvailabilityMask (object) 49 | template <> 50 | struct JSIConverter final { 51 | static inline EventKitCalendarEventAvailabilityMask fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 52 | jsi::Object obj = arg.asObject(runtime); 53 | return EventKitCalendarEventAvailabilityMask( 54 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Busy")), 55 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Free")), 56 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Tentative")), 57 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "Unavailable")) 58 | ); 59 | } 60 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const EventKitCalendarEventAvailabilityMask& arg) { 61 | jsi::Object obj(runtime); 62 | obj.setProperty(runtime, "Busy", JSIConverter>::toJSI(runtime, arg.Busy)); 63 | obj.setProperty(runtime, "Free", JSIConverter>::toJSI(runtime, arg.Free)); 64 | obj.setProperty(runtime, "Tentative", JSIConverter>::toJSI(runtime, arg.Tentative)); 65 | obj.setProperty(runtime, "Unavailable", JSIConverter>::toJSI(runtime, arg.Unavailable)); 66 | return obj; 67 | } 68 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 69 | if (!value.isObject()) { 70 | return false; 71 | } 72 | jsi::Object obj = value.getObject(runtime); 73 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Busy"))) return false; 74 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Free"))) return false; 75 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Tentative"))) return false; 76 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "Unavailable"))) return false; 77 | return true; 78 | } 79 | }; 80 | 81 | } // namespace margelo::nitro 82 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). 2 | 3 | # Getting Started 4 | 5 | > **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding. 6 | 7 | ## Step 1: Start Metro 8 | 9 | First, you will need to run **Metro**, the JavaScript build tool for React Native. 10 | 11 | To start the Metro dev server, run the following command from the root of your React Native project: 12 | 13 | ```sh 14 | # Using npm 15 | npm start 16 | 17 | # OR using Yarn 18 | yarn start 19 | ``` 20 | 21 | ## Step 2: Build and run your app 22 | 23 | With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app: 24 | 25 | ### Android 26 | 27 | ```sh 28 | # Using npm 29 | npm run android 30 | 31 | # OR using Yarn 32 | yarn android 33 | ``` 34 | 35 | ### iOS 36 | 37 | For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps). 38 | 39 | The first time you create a new project, run the Ruby bundler to install CocoaPods itself: 40 | 41 | ```sh 42 | bundle install 43 | ``` 44 | 45 | Then, and every time you update your native dependencies, run: 46 | 47 | ```sh 48 | bundle exec pod install 49 | ``` 50 | 51 | For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html). 52 | 53 | ```sh 54 | # Using npm 55 | npm run ios 56 | 57 | # OR using Yarn 58 | yarn ios 59 | ``` 60 | 61 | If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device. 62 | 63 | This is one way to run your app — you can also build it directly from Android Studio or Xcode. 64 | 65 | ## Step 3: Modify your app 66 | 67 | Now that you have successfully run the app, let's make changes! 68 | 69 | Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh). 70 | 71 | When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload: 72 | 73 | - **Android**: Press the R key twice or select **"Reload"** from the **Dev Menu**, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS). 74 | - **iOS**: Press R in iOS Simulator. 75 | 76 | ## Congratulations! :tada: 77 | 78 | You've successfully run and modified your React Native App. :partying_face: 79 | 80 | ### Now what? 81 | 82 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). 83 | - If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started). 84 | 85 | # Troubleshooting 86 | 87 | If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. 88 | 89 | # Learn More 90 | 91 | To learn more about React Native, take a look at the following resources: 92 | 93 | - [React Native Website](https://reactnative.dev) - learn more about React Native. 94 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. 95 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. 96 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. 97 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. 98 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/HybridEventKitSpec.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// HybridEventKitSpec.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | 16 | // Forward declaration of `EventKitCalendar` to properly resolve imports. 17 | namespace margelo::nitro::eventkit { struct EventKitCalendar; } 18 | // Forward declaration of `EventKitEvent` to properly resolve imports. 19 | namespace margelo::nitro::eventkit { struct EventKitEvent; } 20 | // Forward declaration of `MonthlyEventOptions` to properly resolve imports. 21 | namespace margelo::nitro::eventkit { struct MonthlyEventOptions; } 22 | // Forward declaration of `RangeEventOptions` to properly resolve imports. 23 | namespace margelo::nitro::eventkit { struct RangeEventOptions; } 24 | // Forward declaration of `CreateEventOptions` to properly resolve imports. 25 | namespace margelo::nitro::eventkit { struct CreateEventOptions; } 26 | // Forward declaration of `CreateCalendarOptions` to properly resolve imports. 27 | namespace margelo::nitro::eventkit { struct CreateCalendarOptions; } 28 | // Forward declaration of `EditEventOptions` to properly resolve imports. 29 | namespace margelo::nitro::eventkit { struct EditEventOptions; } 30 | 31 | #include 32 | #include 33 | #include "EventKitCalendar.hpp" 34 | #include "EventKitEvent.hpp" 35 | #include "MonthlyEventOptions.hpp" 36 | #include "RangeEventOptions.hpp" 37 | #include "CreateEventOptions.hpp" 38 | #include 39 | #include "CreateCalendarOptions.hpp" 40 | #include "EditEventOptions.hpp" 41 | 42 | namespace margelo::nitro::eventkit { 43 | 44 | using namespace margelo::nitro; 45 | 46 | /** 47 | * An abstract base class for `EventKit` 48 | * Inherit this class to create instances of `HybridEventKitSpec` in C++. 49 | * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual. 50 | * @example 51 | * ```cpp 52 | * class HybridEventKit: public HybridEventKitSpec { 53 | * public: 54 | * HybridEventKit(...): HybridObject(TAG) { ... } 55 | * // ... 56 | * }; 57 | * ``` 58 | */ 59 | class HybridEventKitSpec: public virtual HybridObject { 60 | public: 61 | // Constructor 62 | explicit HybridEventKitSpec(): HybridObject(TAG) { } 63 | 64 | // Destructor 65 | ~HybridEventKitSpec() override = default; 66 | 67 | public: 68 | // Properties 69 | 70 | 71 | public: 72 | // Methods 73 | virtual std::shared_ptr>> getActiveCalendars() = 0; 74 | virtual std::shared_ptr>> getMonthlyCalendarEvents(const MonthlyEventOptions& options) = 0; 75 | virtual std::shared_ptr>> getCalendarEventsByRange(const RangeEventOptions& options) = 0; 76 | virtual std::shared_ptr> createEvent(const CreateEventOptions& options) = 0; 77 | virtual std::shared_ptr> deleteEvent(const std::string& eventIdentifier) = 0; 78 | virtual std::shared_ptr> openCalendarEvent(const std::string& eventIdentifier) = 0; 79 | virtual std::shared_ptr> createCalendar(const CreateCalendarOptions& options) = 0; 80 | virtual std::shared_ptr> editEvent(const std::string& eventIdentifier, const EditEventOptions& options) = 0; 81 | 82 | protected: 83 | // Hybrid Setup 84 | void loadHybridMethods() override; 85 | 86 | protected: 87 | // Tag for logging 88 | static constexpr auto TAG = "EventKit"; 89 | }; 90 | 91 | } // namespace margelo::nitro::eventkit 92 | -------------------------------------------------------------------------------- /nitrogen/generated/shared/c++/CreateCalendarOptions.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// CreateCalendarOptions.hpp 3 | /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. 4 | /// https://github.com/mrousavy/nitro 5 | /// Copyright © 2025 Marc Rousavy @ Margelo 6 | /// 7 | 8 | #pragma once 9 | 10 | #if __has_include() 11 | #include 12 | #else 13 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 14 | #endif 15 | #if __has_include() 16 | #include 17 | #else 18 | #error NitroModules cannot be found! Are you sure you installed NitroModules properly? 19 | #endif 20 | 21 | // Forward declaration of `EventKitEntityType` to properly resolve imports. 22 | namespace margelo::nitro::eventkit { enum class EventKitEntityType; } 23 | // Forward declaration of `EventKitSourceType` to properly resolve imports. 24 | namespace margelo::nitro::eventkit { enum class EventKitSourceType; } 25 | 26 | #include 27 | #include 28 | #include "EventKitEntityType.hpp" 29 | #include "EventKitSourceType.hpp" 30 | 31 | namespace margelo::nitro::eventkit { 32 | 33 | /** 34 | * A struct which can be represented as a JavaScript object (CreateCalendarOptions). 35 | */ 36 | struct CreateCalendarOptions { 37 | public: 38 | std::string name SWIFT_PRIVATE; 39 | std::optional cgColor SWIFT_PRIVATE; 40 | EventKitEntityType entityType SWIFT_PRIVATE; 41 | std::optional sourceType SWIFT_PRIVATE; 42 | 43 | public: 44 | CreateCalendarOptions() = default; 45 | explicit CreateCalendarOptions(std::string name, std::optional cgColor, EventKitEntityType entityType, std::optional sourceType): name(name), cgColor(cgColor), entityType(entityType), sourceType(sourceType) {} 46 | }; 47 | 48 | } // namespace margelo::nitro::eventkit 49 | 50 | namespace margelo::nitro { 51 | 52 | using namespace margelo::nitro::eventkit; 53 | 54 | // C++ CreateCalendarOptions <> JS CreateCalendarOptions (object) 55 | template <> 56 | struct JSIConverter final { 57 | static inline CreateCalendarOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { 58 | jsi::Object obj = arg.asObject(runtime); 59 | return CreateCalendarOptions( 60 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "name")), 61 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "cgColor")), 62 | JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "entityType")), 63 | JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "sourceType")) 64 | ); 65 | } 66 | static inline jsi::Value toJSI(jsi::Runtime& runtime, const CreateCalendarOptions& arg) { 67 | jsi::Object obj(runtime); 68 | obj.setProperty(runtime, "name", JSIConverter::toJSI(runtime, arg.name)); 69 | obj.setProperty(runtime, "cgColor", JSIConverter>::toJSI(runtime, arg.cgColor)); 70 | obj.setProperty(runtime, "entityType", JSIConverter::toJSI(runtime, arg.entityType)); 71 | obj.setProperty(runtime, "sourceType", JSIConverter>::toJSI(runtime, arg.sourceType)); 72 | return obj; 73 | } 74 | static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { 75 | if (!value.isObject()) { 76 | return false; 77 | } 78 | jsi::Object obj = value.getObject(runtime); 79 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "name"))) return false; 80 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "cgColor"))) return false; 81 | if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "entityType"))) return false; 82 | if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "sourceType"))) return false; 83 | return true; 84 | } 85 | }; 86 | 87 | } // namespace margelo::nitro 88 | --------------------------------------------------------------------------------