---
title: "JSStringCopyCFString(_:_:)"
framework: javascriptcore
role: symbol
role_heading: Function
path: "javascriptcore/jsstringcopycfstring(_:_:)"
---

# JSStringCopyCFString(_:_:)

Creates a Core Foundation string from a JavaScript string.

## Declaration

```swift
func JSStringCopyCFString(_ alloc: CFAllocator!, _ string: JSStringRef!) -> CFString!
```

## Parameters

- `alloc`: The alloc parameter to pass to CFStringCreate.
- `string`: The doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSStringRef to copy into the new doc://com.apple.documentation/documentation/CoreFoundation/CFString.

## Return Value

Return Value A CFString that contains string. Ownership follows The Create Rule.

## See Also

### Converting to and from Core Foundation Strings

- [JSStringCreateWithCFString(_:)](javascriptcore/jsstringcreatewithcfstring(_:).md)
