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

# subscript(_:)

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

## Declaration

```swift
subscript(key: CKRecord.FieldKey) -> (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 the Record’s Fields

- [object(forKey:)](cloudkit/ckrecord/object(forkey:).md)
- [subscript(_:)](cloudkit/ckrecord/subscript(_:)-51whk.md)
- [setObject(_:forKey:)](cloudkit/ckrecord/setobject(_:forkey:).md)
- [allKeys()](cloudkit/ckrecord/allkeys().md)
- [changedKeys()](cloudkit/ckrecord/changedkeys().md)
- [makeIterator()](cloudkit/ckrecord/makeiterator().md)
- [CKRecordKeyValueIterator](cloudkit/ckrecordkeyvalueiterator.md)
- [CKRecordValueProtocol](cloudkit/ckrecordvalueprotocol.md)
- [CKRecordKeyValueSetting](cloudkit/ckrecordkeyvaluesetting.md)
- [CKRecordValue](cloudkit/ckrecordvalue-swift.typealias.md)
