Post

Replies

Boosts

Views

Activity

Reply to Sharing all container content
I'm not sure we understand each other correctly. The goal is for a person to start setting up storage spaces in their home to manage product storage. This person then sends out several invitations (for example, to family members) so that everyone can manage all storage spaces and products with the same rights: adding, modifying, and deleting records. If I understand correctly, a public database is visible to all users of the application without the need for an invitation. So this is not the solution for my use case? I want a space shared between a few users brought together by invitations sent out by an initiator. Once these people are together, they work together on all the content in the database, including additions, without the need for new specific invitations.
Mar ’26
Reply to Sharing all container content
I want to share all the content of a CloudKit database at once between different iCloud accounts. For example, to manage products storage between users. Once the database has been shared or an invitation has been accepted, any additions/modifications/deletions to storage or products must be shared between all users without additional sharing. To be short after the first sharing, everything must be shared without additional new sharing. I think I can't do this in SwiftData (would be the best solution for me as all the current app is based on SwiftDaa) and that I need to use move to CoreData. Is that correct? Or does a mixed solution may be possible (ie .storage with SWiftData and sharing with CoreData)? It seems that “Zone Wide Sharing” could be the solution? But I can't find a sufficiently comprehensive example and I wasn't able to make something working. Ultimately, I realize that this is not a very common use case. With the "ZoneWide Sharing" does it means that we must do a affectedStores or assign(_:to:) to the shared store each time we insert a new managed objects? If you can I'm ok to share my projet with in private and then I can make a summary of the solution to share here. In all cases, I working on a smallest as possible example app.
Mar ’26
Reply to Sharing all container content
I've already played with the samples and was able to share one by one or a set of records. BUT, let me rephrase, I have a set of entities that I want to share ONCE between invited users with ONE sharing at the top. Could you confirm that is it possible? If Yes, there is probably one missing step or misunderstood in the following code. In my understanding, based on the samples, to do this, I'm doing : 1/ on owner and participant : configure a NSPersistentCloudKitContainer with inside a databaseScope = .private store AND a databaseScope = .shared store 2/ on owner before presenting the UICloudSharingController: 2.1/ create a shared zone-wide share ID let shareRecordID = CKRecord.ID(recordName: CKRecordNameZoneWideShare, zoneID: zoneID) 2.2/ create or get an existing CKShare with: func getOrCreateShare() async throws -> CKShare { let zoneID = CKRecordZone.ID(zoneName: sharedZoneName) // Zone-wide share ID let shareRecordID = CKRecord.ID( recordName: CKRecordNameZoneWideShare, zoneID: zoneID ) // Try to fetch existing share do { let existingShare = try await privateDatabase.record(for: shareRecordID) as? CKShare if let share = existingShare { print("Existing share retrieved") return share } } catch let error as CKError where error.code == .unknownItem { print("No existing share, creating new one for the entire zone") let share = CKShare(recordZoneID: zoneID) share[CKShare.SystemFieldKey.title] = "My Sharing Title" as CKRecordValue share[CKShare.SystemFieldKey.shareType] = "net.megy.stokk.inventory" as CKRecordValue share.publicPermission = .none // Private only guard let savedShare = try await privateDatabase.save(share) as? CKShare else { throw CKError(.unknownItem) } print("Return new share created for entire zone") return savedShare } // should not be reached throw CKError(.unknownItem) } 3/ on the participant side, that I've plugged my SceneDelegate windowScene(_ windowScene:userDidAcceptCloudKitShareWith:) to accep the invitation with: public func acceptShare(metadata: CKShare.Metadata) async throws { try await CKContainer(identifier: cloudKitIdentifier).accept(metadata) print("Invitation accepted, syncing...") }
Mar ’26
Reply to Sharing all container content
I'm not sure we understand each other correctly. The goal is for a person to start setting up storage spaces in their home to manage product storage. This person then sends out several invitations (for example, to family members) so that everyone can manage all storage spaces and products with the same rights: adding, modifying, and deleting records. If I understand correctly, a public database is visible to all users of the application without the need for an invitation. So this is not the solution for my use case? I want a space shared between a few users brought together by invitations sent out by an initiator. Once these people are together, they work together on all the content in the database, including additions, without the need for new specific invitations.
Replies
Boosts
Views
Activity
Mar ’26
Reply to Sharing all container content
I want to share all the content of a CloudKit database at once between different iCloud accounts. For example, to manage products storage between users. Once the database has been shared or an invitation has been accepted, any additions/modifications/deletions to storage or products must be shared between all users without additional sharing. To be short after the first sharing, everything must be shared without additional new sharing. I think I can't do this in SwiftData (would be the best solution for me as all the current app is based on SwiftDaa) and that I need to use move to CoreData. Is that correct? Or does a mixed solution may be possible (ie .storage with SWiftData and sharing with CoreData)? It seems that “Zone Wide Sharing” could be the solution? But I can't find a sufficiently comprehensive example and I wasn't able to make something working. Ultimately, I realize that this is not a very common use case. With the "ZoneWide Sharing" does it means that we must do a affectedStores or assign(_:to:) to the shared store each time we insert a new managed objects? If you can I'm ok to share my projet with in private and then I can make a summary of the solution to share here. In all cases, I working on a smallest as possible example app.
Replies
Boosts
Views
Activity
Mar ’26
Reply to Sharing all container content
I feel like all entities are not routed to my shared zone. Maybe something missing in my xcdatamodeld file.
Replies
Boosts
Views
Activity
Mar ’26
Reply to Sharing all container content
I've already played with the samples and was able to share one by one or a set of records. BUT, let me rephrase, I have a set of entities that I want to share ONCE between invited users with ONE sharing at the top. Could you confirm that is it possible? If Yes, there is probably one missing step or misunderstood in the following code. In my understanding, based on the samples, to do this, I'm doing : 1/ on owner and participant : configure a NSPersistentCloudKitContainer with inside a databaseScope = .private store AND a databaseScope = .shared store 2/ on owner before presenting the UICloudSharingController: 2.1/ create a shared zone-wide share ID let shareRecordID = CKRecord.ID(recordName: CKRecordNameZoneWideShare, zoneID: zoneID) 2.2/ create or get an existing CKShare with: func getOrCreateShare() async throws -> CKShare { let zoneID = CKRecordZone.ID(zoneName: sharedZoneName) // Zone-wide share ID let shareRecordID = CKRecord.ID( recordName: CKRecordNameZoneWideShare, zoneID: zoneID ) // Try to fetch existing share do { let existingShare = try await privateDatabase.record(for: shareRecordID) as? CKShare if let share = existingShare { print("Existing share retrieved") return share } } catch let error as CKError where error.code == .unknownItem { print("No existing share, creating new one for the entire zone") let share = CKShare(recordZoneID: zoneID) share[CKShare.SystemFieldKey.title] = "My Sharing Title" as CKRecordValue share[CKShare.SystemFieldKey.shareType] = "net.megy.stokk.inventory" as CKRecordValue share.publicPermission = .none // Private only guard let savedShare = try await privateDatabase.save(share) as? CKShare else { throw CKError(.unknownItem) } print("Return new share created for entire zone") return savedShare } // should not be reached throw CKError(.unknownItem) } 3/ on the participant side, that I've plugged my SceneDelegate windowScene(_ windowScene:userDidAcceptCloudKitShareWith:) to accep the invitation with: public func acceptShare(metadata: CKShare.Metadata) async throws { try await CKContainer(identifier: cloudKitIdentifier).accept(metadata) print("Invitation accepted, syncing...") }
Replies
Boosts
Views
Activity
Mar ’26
Reply to SwiftData with shared and private containers
Same problem for me !!!! use SwiftData, build great apps and POC… Then when you'll need sharing rewrite everything with coredata (that you may not mastered). As an independent developer it is really a pain. At least If I was sure that the sharing feature is schedule!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’26
Reply to Tip always displayed with TipKit
N/A
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to SwiftData public sharing
Same issue for me. A bran new app coded with SwiftData and now I want to share models... And nothing really new regarding SwiftData at WWDV 25. upvote.
Replies
Boosts
Views
Activity
Jun ’25
Reply to CIMotionBlur broken in iOS16 ?
Note that I've made a bug report
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to How do I downgrade the simulator in Xcode?
At least from xCode 14, now it's in "Windows" menu, "Devices and Simulators". You can download an older iOS SDK and create a simulator with it.
Replies
Boosts
Views
Activity
Oct ’22
Reply to xCode localization export failed for shared framework with multiple destinations
As requested, bug Feedback Done #FB11663961. Hope to get some news with this chanel.
Replies
Boosts
Views
Activity
Oct ’22
Reply to Export For Localization fails with 'Duplicate localized resource "folder/Localizable.strings" found'
Same issue with xCode 14 and multiple targets project (iOS app, WatcOS app, iOS widhget extension, WatchOS widget extension et WatchOS App). "Clean Build Folder" isn't the solution for me.
Replies
Boosts
Views
Activity
Oct ’22
Reply to iOS widget always displaying placeholder on simulator or device
Note that I think the issue happen when the view is used in an IntentConfiguration (and everything works fine when used in StaticConfiguration). Note that I'm on xCode 14. Could it be an Apple issue?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to WatchWidget does not define either an NSExtensionMainStoryboard or NSExtensionPrincipalClass
Same issue.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’22