---
title: "getObjectValue(_:for:errorDescription:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/personnamecomponentsformatter/getobjectvalue(_:for:errordescription:)"
---

# getObjectValue(_:for:errorDescription:)

Returns by reference a person name components object after creating it from a given string.

## Declaration

```swift
func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool
```

## Parameters

- `obj`: On return, contains an instance of doc://com.apple.foundation/documentation/Foundation/NSPersonNameComponents, or nil if conversion failed.
- `string`: A string that is parsed to create a person name components object.
- `error`: If an error occurs, upon return contains an doc://com.apple.foundation/documentation/Foundation/NSError object in the doc://com.apple.foundation/documentation/Foundation/NSCocoaErrorDomain with code doc://com.apple.foundation/documentation/Foundation/NSFormattingError-swift.var that explains why the conversion failed. If you pass in nil for error, you are indicating that you are not interested in error information.

## Return Value

Return Value true if conversion succeeded; otherwise false.

## See Also

### Converting Between Person Name Components and Strings

- [localizedString(from:style:options:)](foundation/personnamecomponentsformatter/localizedstring(from:style:options:).md)
- [string(from:)](foundation/personnamecomponentsformatter/string(from:).md)
- [annotatedString(from:)](foundation/personnamecomponentsformatter/annotatedstring(from:).md)
- [personNameComponents(from:)](foundation/personnamecomponentsformatter/personnamecomponents(from:).md)
