---
title: "valueWithBytes:objCType:"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsvalue/valuewithbytes:objctype:"
---

# valueWithBytes:objCType:

Creates a value object containing the specified value, interpreted with the specified Objective-C type.

## Declaration

```occ
+ (NSValue *) valueWithBytes:(const void *) value objCType:(const char *) type;
```

## Parameters

- `value`: A pointer to data to be stored in the new value object.
- `type`: The Objective-C type of value, as provided by the @encode() compiler directive. Do not hard-code this parameter as a C string.

## Return Value

Return Value A new value object that contains value, which is interpreted as being of the Objective-C type type.

## Discussion

Discussion See Number and Value Programming Topics for other considerations in creating a value object and code examples.

## See Also

### Working with Raw Values

- [init(bytes:objCType:)](foundation/nsvalue/init(bytes:objctype:).md)
- [init(_:withObjCType:)](foundation/nsvalue/init(_:withobjctype:).md)
- [getValue(_:)](foundation/nsvalue/getvalue(_:).md)
- [objCType](foundation/nsvalue/objctype.md)
