---
title: "JSStringCreateWithCFString(_:)"
framework: javascriptcore
role: symbol
role_heading: Function
path: "javascriptcore/jsstringcreatewithcfstring(_:)"
---

# JSStringCreateWithCFString(_:)

Creates a JavaScript string from a Core Foundation string.

## Declaration

```swift
func JSStringCreateWithCFString(_ string: CFString!) -> JSStringRef!
```

## Parameters

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

## Return Value

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

## Discussion

Discussion The system optimizes this function to take advantage of cases when CFStringGetCharactersPtr(_:) returns a valid pointer.

## See Also

### Converting to and from Core Foundation Strings

- [JSStringCopyCFString(_:_:)](javascriptcore/jsstringcopycfstring(_:_:).md)
