---
title: "setDataSource(_:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webdocumentrepresentation/setdatasource(_:)"
---

# setDataSource(_:)

Sets the receiver’s data source.

## Declaration

```swift
func setDataSource(_ dataSource: WebDataSource!)
```

## Parameters

- `dataSource`: The data source to associate with the object.

## Discussion

Discussion This method is invoked soon after the document representation is created.

## See Also

### Related Documentation

- [WebKit Objective-C Programming Guide](apple-archive/documentation/Cocoa/Conceptual/DisplayWebContent.md)
- [finishedLoading(with:)](webkit/webdocumentrepresentation/finishedloading(with:).md)
