---
title: "setURL(_:for:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/seturl(_:for:)"
---

# setURL(_:for:)

Sets the URL associated with a rectangle in a PDF graphics context.

## Declaration

```swift
func setURL(_ url: CFURL, for rect: CGRect)
```

## Parameters

- `url`: A URL that specifies the destination of the contents associated with the rectangle.
- `rect`: A rectangle specified in default user space (not device space).

## See Also

### Managing a PDF Graphics Context

- [beginPDFPage(_:)](coregraphics/cgcontext/beginpdfpage(_:).md)
- [endPDFPage()](coregraphics/cgcontext/endpdfpage().md)
- [addDestination(_:at:)](coregraphics/cgcontext/adddestination(_:at:).md)
- [setDestination(_:for:)](coregraphics/cgcontext/setdestination(_:for:).md)
- [addDocumentMetadata(_:)](coregraphics/cgcontext/adddocumentmetadata(_:).md)
- [closePDF()](coregraphics/cgcontext/closepdf().md)
