// // CloudKitSyncMonitor.swift // Notes // // Created by Claude Code on 13/10/2025. // import Foundation import CoreData import Combine class CloudKitSyncMonitor: ObservableObject { private var cancellables = Set() init() { NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification) .sink { [weak self] notification in self?.handleCloudKitEvent(notification) } .store(in: &cancellables) } private func handleCloudKitEvent(_ notification: Notification) { print("CloudKit sync event received...") // Handle CloudKit sync events if needed // In SwiftUI with @FetchRequest, the UI updates automatically // when Core Data changes, so additional handling may not be necessary } }