I don't think you can delete the original User Record Type in CloudKit BUT if you made your own you can!
Make your own record Type then set a ID to it(you can use your ID that's linked to the original User record by getting it using :
Lets call our own user record UserInfo ;)
public let container = CKContainer.init(identifier: "cloudkitIDDBName")
guard let recordID = recordID, error == nil else { return}
DispatchQueue.main.async {
self.cloudkitUserRecordID = recordID
}
}
Once you get the recordID save that somewhere in a property or something then when you create a User:)
Then save a new UserInfo (our own user record type) with the user's info you want to save something like below:
firstTimeUserRecord["userID"] = recordID
firstTimeUserRecord["username"] = username
container.publicCloudDatabase.save(firstTimeUserRecord) { newUserRecord, error in
//etc
}
then when you want to delete you can do like below
container.publicCloudDatabase.delete(withRecordID: self.recordID) { record, error in
//handle your errors :/etc
}
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: