---
title: "bool(forKey:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsubiquitouskeyvaluestore/bool(forkey:)"
---

# bool(forKey:)

Returns the Boolean value associated with the specified key.

## Declaration

```swift
func bool(forKey aKey: String) -> Bool
```

## Parameters

- `aKey`: The key to retrieve from the iCloud key-value store.

## Return Value

Return Value The Boolean value associated with aKey, or false if the key isn’t present.

## Discussion

Discussion This method automatically coerces certain values to their equivalent Boolean meanings. For example, it coerces the numbers 1 and 1.0, and the strings “true”, “YES”, and “1” to the value true.

## See Also

### Getting values

- [double(forKey:)](foundation/nsubiquitouskeyvaluestore/double(forkey:).md)
- [longLong(forKey:)](foundation/nsubiquitouskeyvaluestore/longlong(forkey:).md)
- [string(forKey:)](foundation/nsubiquitouskeyvaluestore/string(forkey:).md)
- [data(forKey:)](foundation/nsubiquitouskeyvaluestore/data(forkey:).md)
- [object(forKey:)](foundation/nsubiquitouskeyvaluestore/object(forkey:).md)
- [array(forKey:)](foundation/nsubiquitouskeyvaluestore/array(forkey:).md)
- [dictionary(forKey:)](foundation/nsubiquitouskeyvaluestore/dictionary(forkey:).md)
- [dictionaryRepresentation](foundation/nsubiquitouskeyvaluestore/dictionaryrepresentation.md)
