---
title: documentSource()
framework: webkit
role: symbol
role_heading: Instance Method
path: webkit/webdocumentrepresentation/documentsource()
---

# documentSource()

Returns the receiver’s source as text.

## Declaration

```swift
func documentSource() -> String!
```

## Return Value

Return Value Returns the document source associated with the receiver or nil if the source cannot be provided.

## Discussion

Discussion For example, for HTML documents, the receiver should return the HTML source.

## See Also

### Getting document source

- [canProvideDocumentSource()](webkit/webdocumentrepresentation/canprovidedocumentsource().md)
