---
title: "init(record:action:)"
framework: cloudkit
role: symbol
role_heading: Initializer
path: "cloudkit/ckrecord/reference/init(record:action:)"
---

# init(record:action:)

Creates a reference object that points to the specified record object.

## Declaration

```swift
convenience init(record: CKRecord, action: CKRecord.ReferenceAction)
```

## Parameters

- `record`: The target record of the reference.
- `action`: The ownership options to use for the records. If you specify the doc://com.apple.cloudkit/documentation/CloudKit/CKRecord/ReferenceAction/deleteSelf option, the object that the recordID parameter references becomes the owner of (or acts as the parent of) any objects that use this reference object. For a list of possible values, see doc://com.apple.cloudkit/documentation/CloudKit/CKRecord/ReferenceAction.

## Return Value

Return Value An initialized reference object that points to the specified record.

## Discussion

Discussion Use this method to initialize a reference to a local record object. You can reference a local record that you create, or one that you fetch from the server. When you create a reference object for use in a search predicate, the predicate ignores the value in the action parameter. Search predicates use only the ID of the record during their comparison.

## See Also

### Creating a Reference

- [init(recordID:action:)](cloudkit/ckrecord/reference/init(recordid:action:).md)
- [CKRecord.Reference.Action](cloudkit/ckrecord/reference/action-swift.typealias.md)
