Post

Replies

Boosts

Views

Activity

Reply to Orphaning a CKAsset
Make this function handle nil values for largeImageURL and thumbnailURL… override func addAssetsToRecord(_ record: CKRecord) { // add the image data as CKAssets if let largeImageURL, let thumbnailURL { let largeAsset = CKAsset(fileURL: largeImageURL) let thumbAsset = CKAsset(fileURL: thumbnailURL) record.setObject(largeAsset, forKey: "largeImage") record.setObject(thumbAsset, forKey: "thumbnailImage") } else { record.setObject(nil, forKey: "largeImage") record.setObject(nil, forKey: "thumbnailImage") } another way is to just delete the ImageAsset CKRecord itself, which will also orphan the CKAssets.
2w
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
Jul ’25
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
Reply to Orphaning a CKAsset
Make this function handle nil values for largeImageURL and thumbnailURL… override func addAssetsToRecord(_ record: CKRecord) { // add the image data as CKAssets if let largeImageURL, let thumbnailURL { let largeAsset = CKAsset(fileURL: largeImageURL) let thumbAsset = CKAsset(fileURL: thumbnailURL) record.setObject(largeAsset, forKey: "largeImage") record.setObject(thumbAsset, forKey: "thumbnailImage") } else { record.setObject(nil, forKey: "largeImage") record.setObject(nil, forKey: "thumbnailImage") } another way is to just delete the ImageAsset CKRecord itself, which will also orphan the CKAssets.
Replies
Boosts
Views
Activity
2w
Reply to Orphaning a CKAsset
can you show some code?
Replies
Boosts
Views
Activity
2w
Reply to Draw An Outline Around a Model Entity
back in my SceneKit days, I had to turn to SCNTechnique to make something like this, with a sequence of render passes processing the geometry data. Would love to hear that RealityKit has something like this built in. fwiw.
Topic: Spatial Computing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to SwiftData and CloudKit not synching between devices
How can I check if the data is actually stored in the cloud https://icloud.developer.apple.com/dashboard
Replies
Boosts
Views
Activity
Oct ’25
Reply to SceneKit is now deprecated - when it will be removed?
https://developer.apple.com/videos/play/wwdc2025/288 this is Apple's official statement on SceneKit.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
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
Replies
Boosts
Views
Activity
Jul ’25
Reply to EXC_BAD_ACCESS When saving core data
you're jumping into a background thread, then accessing CoreData using the viewContext, which should only be used on the main thread.
Replies
Boosts
Views
Activity
Jun ’25
Reply to Alternatives to SceneView
nvrmnd
Topic: Spatial Computing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’25
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:
Replies
Boosts
Views
Activity
Jun ’25
Reply to dual predicate search using CoreData
look at NSCompountPredicate
Replies
Boosts
Views
Activity
Mar ’25
Reply to Why is data not encrypted on icloud.developer.apple.com when i am using encrypted field
my guess is the web client to CloudKit is like any other client, and likely decrypts the data on display. better to ask, is the data encrypted in transit? You could use a packet sniffer to intercept the requests to/from CloudKit, and verify the encrypted fields are not cleartext.
Replies
Boosts
Views
Activity
Dec ’24
Reply to Unable to Play Music With Music Kit
my code calls player.prepareToPlay explicitly, fwiw
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to SceneKit app randomly crashes with EXC_BAD_ACCESS in jet_context::set_fragment_texture
random crashes, imo, often mean threading issues, and indeed what you shared shows a crash in thread 2 with several other threads running as well. FWIW, early in my SceneKit days, I experienced similar crashes, and solved it by refactoring my code to add and remove SCNNodes only in main thread. fwiw.
Topic: Graphics & Games SubTopic: SceneKit Tags:
Replies
Boosts
Views
Activity
Sep ’24
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) } }
Replies
Boosts
Views
Activity
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¢
Replies
Boosts
Views
Activity
Aug ’24