---
title: "setOption(_:forKey:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentstoredescription/setoption(_:forkey:)"
---

# setOption(_:forKey:)

Sets an option on the store.

## Declaration

```swift
func setOption(_ option: NSObject?, forKey key: String)
```

## Parameters

- `option`: The value to be set for an option on the store.
- `key`: The key of the value to be set for an option on the store.

## Discussion

Discussion If a value was previously set for the given option, that value is replaced with the given value. Note that the keys are case-sensitive. For a list of the available options, see NSPersistentStoreCoordinator.

## See Also

### Configuring a Persistent Store Description

- [url](coredata/nspersistentstoredescription/url.md)
- [configuration](coredata/nspersistentstoredescription/configuration.md)
- [timeout](coredata/nspersistentstoredescription/timeout.md)
- [type](coredata/nspersistentstoredescription/type.md)
- [isReadOnly](coredata/nspersistentstoredescription/isreadonly.md)
- [shouldAddStoreAsynchronously](coredata/nspersistentstoredescription/shouldaddstoreasynchronously.md)
- [shouldInferMappingModelAutomatically](coredata/nspersistentstoredescription/shouldinfermappingmodelautomatically.md)
- [shouldMigrateStoreAutomatically](coredata/nspersistentstoredescription/shouldmigratestoreautomatically.md)
- [setValue(_:forPragmaNamed:)](coredata/nspersistentstoredescription/setvalue(_:forpragmanamed:).md)
