I've been trying for a week to make sharing work, using coredata, still no luck. Now I've made the simplest code to see if something works:
struct CloudKitShareView: UIViewControllerRepresentable {
@ObservedObject var controller: MainViewController
func makeUIViewController(context: Context) -> UICloudSharingController {
let container = PersistenceController.shared.container
let cloudSharingController = UICloudSharingController { controller, completion in
container.share(self.controller.expenses, to: nil) { objectIDs, share, container, error in
completion(share, container, error)
}
}
return cloudSharingController
}
func updateUIViewController(
_ uiViewController: UIViewControllerType,
context: Context
) { }
}
when i call it using
.popover(isPresented: $controller.presentSharingController) {
CloudKitShareView(controller: controller)
}
it shows a blank screen and nothing happens, help me understand please! Thank you