Contents

setObject(_:forKey:)

Stores an object in the record using the specified key.

Declaration

func setObject(_ object: (any __CKRecordObjCValue)?, forKey key: String)

Parameters

  • object:

    The object to store using the specified key. It must be one of the data types in Ckrecord. You receive an error if you use a data type that CloudKit doesn’t support. If you specify nil, CloudKit removes any object that the record associates with the key.

  • key:

    The key to associate with object. Use this key to retrieve the value later. A key must consist of one or more alphanumeric characters and must start with a letter. CloudKit permits the use of underscores, but not spaces. Avoid using a key that matches the name of any property of CKRecord.

See Also

Accessing a Record’s Fields