---
title: "init(_:withObjCType:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsvalue/init(_:withobjctype:)"
---

# init(_:withObjCType:)

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

## Declaration

```swift
init(_ value: UnsafeRawPointer, withObjCType type: UnsafePointer<CChar>)
```

## 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 This method has the same effect as valueWithBytes:objCType: and may be deprecated in a future release. You should use valueWithBytes:objCType: instead.

## See Also

### Working with Raw Values

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