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

# setDataSource(_:)

Invoked when the data source for this document has been changed.

## Declaration

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

## Parameters

- `dataSource`: The new data source for the document.

## See Also

### Related Documentation

- [WebKit Objective-C Programming Guide](apple-archive/documentation/Cocoa/Conceptual/DisplayWebContent.md)

### Setting the data source

- [dataSourceUpdated(_:)](webkit/webdocumentview/datasourceupdated(_:).md)
