Post

Replies

Boosts

Views

Activity

Reply to CKSubscription in shared records
Where you are using CKRecordZoneSubscription to sync the private database, you can use CKDatabaseSubscription to sync shared databases. See CloudCore for an example. Are you syncing CloudKit to CoreData? I create an observer singleton with a FetchedResultsController, detecting when changes occur in the root object (as synced from CloudKit), and post local notifications as appropriate. See CarShuffle for an example
2w
Reply to Creating a voxel mesh and render it using metal within a RealityKit ImmersiveView
Look at using these in your modelComponent: MeshResource, MeshResource.Contents, MeshResource.Part e.g. func meshContents() -> MeshResource.Contents { // update mesh data … var meshPart = MeshResource.Part(…) meshPart.positions = .init(positions) meshPart.textureCoordinates = MeshBuffer(textureCoordinates) meshPart.triangleIndices = .init(indices) var contents = MeshResource.Contents() contents.models = [.init(…, parts: [meshPart])] return contents } let meshResource = try await MeshResource(from: meshContents()) let modelComponent = ModelComponent(mesh: meshResource, …) for loop { try modelComponent.mesh.replace(with: meshContents()) }
Topic: Spatial Computing SubTopic: General Tags:
Jun ’25
Reply to Can't accept CloudKit share invitation from my SwiftUI application
I implemented the userDidAcceptCloudKitShareWith… in the SceneDelegate, and set up the scene delegate as such: class AppDelegate { // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { let config = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) config.delegateClass = SceneDelegate.self return config } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) { let acceptShareOperation = CKAcceptSharesOperation(shareMetadatas: [cloudKitShareMetadata]) acceptShareOperation.qualityOfService = .userInteractive acceptShareOperation.perShareResultBlock = { meta, result in guard let recordID = meta.hierarchicalRootRecordID else { return } // do the things… } acceptShareOperation.acceptSharesResultBlock = { result in // N/A } CKContainer(identifier: cloudKitShareMetadata.containerIdentifier).add(acceptShareOperation) } }
Aug ’24
Reply to CoreData sharing/collaboration feature is broken
I've often wondered how NSPersistentCloudKitContainer.share… works, and your example goes a long way to explaining it. When you identify the objects you want to share, they get moved to a new zone. and that zone is what is shared. but the API probably wasn't designed to handle the scenario you describe, so once a record is moved to a shared zone, it doesn't/can't get move to another zone. 2¢
Aug ’24