How irochi1184/kakebo works
Project Type and Purpose
• Project Type: Native iOS application with an accompanying WidgetKit extension.
• Architectural Style: MVVM + Combine (ObservableObject) for UI data flow, AppGroup-backed JSON persistence, local notifications, and WidgetKit integration.
• Primary Function: Fast expense/income logging, calendar visualization, recurring To-Dos, local notifications, and home-screen widget.
File Structure
• Top-Level Targets:
• KaKeBo (main iOS app)
• KaKeBoWidget (WidgetKit / Live Activity extension)
• Shared (code shared via AppGroup)
• Key Folders in KaKeBo:
• App (AppDelegate, main SwiftUI App entrypoint)
• Models (DTOs, domain models)
• Services (DataStore, TodoStore, ReminderStore, ThemeStore)
• Views (SwiftUI view hierarchy organized by feature: Calendar, Components, Settings, Paywall, etc.)
• Persistence & Configuration:
• JSON files under AppGroup container: transactions.json, categories.json, budgets.json
• Info.plist, entitlements (AppGroup and widget extension)
• Combine, UserNotifications, WidgetKit frameworks
README for Insights
• MVVM + ObservableObject pattern
• JSON-based local persistence (no CoreData)
• AppGroup container for shared data between app and widget
• WidgetKit and UserNotifications integration
• Future directions: iCloud sync, PDF reports, AI analytics
Main Components
a. Frontend Layer (iOS App)
• SwiftUI Views (KaKeBo/Views)
• ViewModels (ObservableObject classes in Services and Stores)
• App entrypoints: KaKeBoApp.swift and AppDelegate.swift
b. Business Logic Layer
• Models (domain structs: Transaction, Category, Budget, ToDo templates, ReminderRule, etc.)
• Services / Stores
• DataStore (handles JSON I/O, backup)
• TodoStore (manages calendar To-Dos)
• ReminderStore / ReminderManager (schedules notifications)
• ThemeStore, PurchaseManager
c. Persistence Layer
• AppGroup Directory (shared container)
• JSON files: categories.json, transactions.json, budgets.json
• Shared code: TransactionDTO and AppGroup helper in Shared/
d. System Frameworks & External Services
• Combine (data binding)
• UserNotifications (local scheduling & presentation)
• WidgetKit (home screen widget, live activity)
• AppStorage / UserDefaults (user settings)
e. Widget Extension
• KaKeBoWidgetBundle, Intent definitions, Widget entrypoint
• Reads JSON from AppGroup
• Live Activity & Timeline reload via WidgetCenter
f. Utilities & Helpers
• CSV export (ActivityView, CSVDocument)
• Keyboard observer, Haptic feedback
• Sample backup generator
Relationships and Data Flow
• UI Views ↔ ViewModels (@Published properties via Combine)
• ViewModels → Services/Stores (method calls for CRUD)
• Services/Stores ↔ Persistence (read/write JSON in AppGroup)
• Services → WidgetKit (WidgetCenter.shared.reloadAllTimelines())
• Services → UserNotifications (schedule/remove notifications)
• Widget Extension → Persistence (reads JSON, updates timeline)
• Triggers:
• On JSON file update → Widget reload
• On user action → DataStore.write() → JSON write
Architectural Patterns and Design Principles
• MVVM: separate Views, ViewModels (in Stores/Services), Models
• Reactive data flow using Combine (ObservableObject & @Published)
• AppGroup for IPC between app and widget
• Single source of truth in JSON files
• Modularization: Shared code module for DTOs and AppGroup paths
• Lightweight persistence: JSONEncoder/Decoder instead of CoreData
• Local notifications decoupled via ReminderManager
Detail Without Overthinking
• Every logical component folder as a separate module if it plays a distinct role
• Do not merge UI and business logic—keep Views, ViewModels, Services distinct
• AppGroup boundary clearly (show container path, shared JSON files)
• How WidgetKit and UserNotifications integrate but remain decoupled from core UI