---
title: "setActive(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisearchdisplaycontroller/setactive(_:animated:)"
---

# setActive(_:animated:)

Displays or hides the search interface, optionally with animation.

## Declaration

```swift
func setActive(_ visible: Bool, animated: Bool)
```

## Parameters

- `visible`: doc://com.apple.documentation/documentation/Swift/true to display the search interface if it is not already displayed; doc://com.apple.documentation/documentation/Swift/false to hide the search interface if it is currently displayed.
- `animated`: doc://com.apple.documentation/documentation/Swift/true to use animation for a change in visible state, otherwise doc://com.apple.documentation/documentation/Swift/false.

## Discussion

Discussion When the user focus in the search field of a managed search bar, the search display controller automatically displays the search interface. You can use this method to force the search interface to appear.

## See Also

### Displaying the search Interface

- [isActive](uikit/uisearchdisplaycontroller/isactive.md)
