---
title: "subscript(_:)"
framework: cloudkit
role: symbol
role_heading: Instance Subscript
path: "cloudkit/ckrecordkeyvaluesetting/subscript(_:)"
---

# subscript(_:)

Returns the object that the record stores for the specified key.

## Declaration

```swift
subscript(key: String) -> (any __CKRecordObjCValue)? { get set }
```

## Parameters

- `key`: The string that identifies a field in the record. 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.

## Return Value

Return Value The object for the specified key, or nil if no such key exists in the record.

## See Also

### Accessing a Record’s Fields

- [object(forKey:)](cloudkit/ckrecordkeyvaluesetting/object(forkey:).md)
- [setObject(_:forKey:)](cloudkit/ckrecordkeyvaluesetting/setobject(_:forkey:).md)
- [allKeys()](cloudkit/ckrecordkeyvaluesetting/allkeys().md)
- [changedKeys()](cloudkit/ckrecordkeyvaluesetting/changedkeys().md)
