---
title: "CFAttributedStringCreateCopy(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfattributedstringcreatecopy(_:_:)"
---

# CFAttributedStringCreateCopy(_:_:)

Creates an immutable copy of an attributed string.

## Declaration

```swift
func CFAttributedStringCreateCopy(_ alloc: CFAllocator!, _ aStr: CFAttributedString!) -> CFAttributedString!
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new attributed string. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `aStr`: The attributed string to copy.

## Return Value

Return Value An immutable attributed string with characters and attributes identical to those of aStr. Returns NULL if there was a problem copying the object. Ownership follows the The Create Rule.

## See Also

### Creating a CFAttributedString

- [CFAttributedStringCreate(_:_:_:)](corefoundation/cfattributedstringcreate(_:_:_:).md)
- [CFAttributedStringCreateWithSubstring(_:_:_:)](corefoundation/cfattributedstringcreatewithsubstring(_:_:_:).md)
- [CFAttributedStringGetLength(_:)](corefoundation/cfattributedstringgetlength(_:).md)
- [CFAttributedStringGetString(_:)](corefoundation/cfattributedstringgetstring(_:).md)
