<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSStringCopyCFString(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@F@JSStringCopyCFString"
  },
  "title" : "JSStringCopyCFString(_:_:)"
}
-->

# JSStringCopyCFString(_:_:)

Creates a Core Foundation string from a JavaScript string.

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

## Parameters

`alloc`

The `alloc` parameter to pass to `CFStringCreate`.

`string`

The [`JSStringRef`](/documentation/JavaScriptCore/JSStringRef) to copy into the new <doc://com.apple.documentation/documentation/CoreFoundation/CFString>.

## Return Value

A <doc://com.apple.documentation/documentation/CoreFoundation/CFString> that contains `string`. Ownership follows [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)