---
title: updateBodyIfNeeded()
framework: swiftui
role: symbol
role_heading: Instance Method
path: swiftui/wkhostingcontroller/updatebodyifneeded()
---

# updateBodyIfNeeded()

Updates the interface controller’s set of views immediately, if updates are pending.

## Declaration

```swift
@MainActor @preconcurrency func updateBodyIfNeeded()
```

## Discussion

Discussion Calling this method forces the hosting controller to update its current set of views, but only if there are pending changes. If there are no pending changes, this method does nothing. To mark the interface controller as needing an update, call setNeedsBodyUpdate().

## See Also

### Updating the root view

- [setNeedsBodyUpdate()](swiftui/wkhostingcontroller/setneedsbodyupdate().md)
