I have an app for client management that stores data in Core Data with an NSPersistentCloudKitContainer. Each manager have their clients in the Core Data Private Database, and each client could have associated files (images, documents, etc) that are stored in app's own folder structure in iCloud Drive.
Eventually, a manager can decide if to share a client with another manager, in order to have a shared managed client (readable, or writable+readable by others managers which share the same client). This is done by moving the Client from the Private Database to the Shared Database following the Apple's guidelines:
https://developer.apple.com/videos/play/wwdc2021/10015/
This is the structure:
The problem is: the database record is shared correctly, but the iCloud Drive Files are not shared (obviously). My goal is to get working the iCloud Drive Client Files (every client has a single Folder) with the minimum effort from the user. I cannot get working the iCloud Drive Sharing from my app, only the Core Data Sharing, so (in development environment) I have to share the Client Core Data Info from the App sheet, and then, go to Finder and share the Client's folder and send the link, so it would be a bit confusing for my users.
Any approach for get working iCloud Drive File Sharing from the (inside) my app? Generate a link and automatically send to the other user.
Or, better, an approach to get working this sharing with a single action from the user (only share once, and it sends the core data info and icloud drive file sharing).
Post
Replies
Boosts
Views
Activity
I'm trying to replicate the behavior of the iOS sample application provided by Apple in order to share my Core Data objects through CloudKit.
I am able to share CKRecords through Mail and Airdrop by obtaining the URL, but I cannot be able to get the iCloud Share modal window.
let sharingService = NSSharingService(named: .cloudSharing)
sharingService?.delegate = self
coredataContainer.share([ManagedObjectToShare], to: nil, completion: { [weak self] objectIDs, shareCK, container, error in
if let error = error {
fatalError(error.localizedDescription)
} else {
self?.sharingService?.perform(withItems: [shareCK?.url])
}
})
If I substitute the .cloudSharing for .composeEmail, the modal window opens correctly and provides me an URL to access to the object, but nothing happens when .cloudSharingis seated as SharingService.
How can I accomplish this?
When using an ScrollView { ... } in SwiftUI 2.0 in macOS Big Sur (or prior) the scroll runs fine but it is slower than NSScrollView in Cocoa. The same behaviour occurs in Cocoa when isResponsiveScrolling is set to false:
override class var isCompatibleWithResponsiveScrolling: Bool { return false }
When using a List { ... } in SwiftUI the scroll is responsive.
More info: https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKitOlderNotes/#10_9Scrolling
Is there any way to get the ScrollView in SwiftUI with responsive behavior?
Xcode 12 beta 4 | macOS Big Sur beta 4 | SwiftUI 2.0
In macOS Big Sur beta 3 and Xcode 12 beta 3, when I execute this:
if let splitController = appWindow.contentViewController as? NSSplitViewController {
	 splitController.splitViewItems[0] = NSSplitViewItem(sidebar: MY_VIEW_CONTROLLER_SIDEBAR)
	 splitController.splitViewItems[1] = NSSplitViewItem(viewController: MY_VIEW_CONTROLLER_CONTENT)
}
The sidebar loses the fullHeight layout and the toolbar starts using the full width window instead of the splitViewItem[1] width, as occurs inn beta 1 and 2 of macOS Big Sur.
This code also was killing the titlebar separator shadow in previous versions, so I'm asking if I'm setting correctly the NSSplitViewItem.
You can check sample project here:
https://github.com/albbadia/SplitController-Behavior