---
title: dataRepresentation
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/url/datarepresentation
---

# dataRepresentation

The data representation of the URL’s relativeString.

## Declaration

```swift
var dataRepresentation: Data { get }
```

## Discussion

Discussion If the URL was initialized with init?(dataRepresentation:relativeTo:isAbsolute:), the data representation returned are the same bytes as those used at initialization; otherwise, the data representation returned are the bytes of the relativeString encoded with UTF8 string encoding.

## See Also

### Working with the data representation of a URL

- [init(dataRepresentation:relativeTo:isAbsolute:)](foundation/url/init(datarepresentation:relativeto:isabsolute:).md)
