Custom CloudKit sharing workflow

The use case

Suppose that you have an application that shares users information. Some of those need to be private and shared only among friends, while others should be publicly accessible from every participants in the container.

firstName: String
lastName: String
thumbnail: Data
privateShareUrl: String
phoneNumber: String
email: String

CloudKit general workflow and limitations

As stated above, one of the main concern in using CloudKit sharing default workflow was related to the very basic UI customization options. Specifically, the basic workflow uses a very rigid schema:

  1. Pass it to a specific UICloudSharingController
  2. Create a URL to share using third party apps
  1. Implement some delegates on the UIApplication

It would be great, if I could select receivers of my private information by simple tapping the users icon in my app.

Implementation

The first thing that we need to do is enabling userDiscoverability among app users, otherwise the rest of the process will not work due to privacy constraints.

Our approach

Since our application already contains users, I would like to bypass this workflow by using the privateShareUrl field as an entry point for everyone that needs to fetch private information from a specific user.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store