This is unverified code, but I understand that custom containers allow you to share these containers in multiple applications. In the Features panel, you can choose which of all containers is available in all of your other applications that you want to use in this application. The default container is iCloud.com.MyCompany.MyApp , which should be automatically selected. Now that you have specified which containers you want, you can access them using init()
let container = CKContainer(identifier: "iCloud.com.MyCompany.OneOfMyApps")
Basically, an identifier is one of the identifiers listed in the iCloud capabilities panel in custom containers.
source share