application iOS de notes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notes/Notes/CloudKitSyncMonitor.swift

29 lines
849 B

//
// CloudKitSyncMonitor.swift
// Notes
//
// Created by Claude Code on 13/10/2025.
//
import Foundation
import CoreData
import Combine
class CloudKitSyncMonitor: ObservableObject {
private var cancellables = Set<AnyCancellable>()
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
}
}