Instance Method

itemThumbnailData(for:)

Asks the delegate for the thumbnail image data to display on the invitation.

Declaration

optional func itemThumbnailData(for csc: UICloudSharingController) -> Data?

Discussion

Implement this method to return image data representing the shared recording. Returning nil tells the UICloudSharingController instance to display the generic image. Not implementing this method is the same as returning nil.

itemThumbnailData(for:) is called only when creating a new share. For an existing share, the thumbnail image is retrieved from the share using the CKShare_SystemFieldKey_imageData key.

Listing 1 shows an example of retrieving the image data from a data set stored in an asset catalog found in the main bundle.

Listing 1

Tell the controller which image to display.

func itemThumbnailData(for csc: UICloudSharingController) -> Data? {
  guard let icon = NSDataAsset(name: "thumbnail") else {
    return nil
  }  

  return icon.data
}

See Also

Configuring the View Controller

func itemTitle(for: UICloudSharingController) -> String?

Asks the delegate for the title to display on the invitation screen.

Required.

func itemType(for: UICloudSharingController) -> String?

Asks the delegate for the Uniform Type Identifier (UTI) of the item.