---
title: "url(at:effectiveRange:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsattributedstring/url(at:effectiverange:)"
---

# url(at:effectiveRange:)

Returns a URL, either from a link attribute or from text at the specified location that appears to be a URL string, for use in automatic link detection.

## Declaration

```swift
func url(at location: Int, effectiveRange: NSRangePointer) -> URL?
```

## Parameters

- `location`: The character index in the string at which the method checks for a link.
- `effectiveRange`: The actual range covered by the link attribute or URL string, or of non-URL text if no apparent URL is found.

## Return Value

Return Value The URL found at location.

## See Also

### Deprecated Instance Methods

- [draw(with:options:)](foundation/nsattributedstring/draw(with:options:).md)
- [boundingRect(with:options:)](foundation/nsattributedstring/boundingrect(with:options:).md)
