---
title: "setEditing(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/setediting(_:animated:)"
---

# setEditing(_:animated:)

Sets whether the view controller shows an editable view.

## Declaration

```swift
func setEditing(_ editing: Bool, animated: Bool)
```

## Parameters

- `editing`: If doc://com.apple.documentation/documentation/Swift/true, the view controller should display an editable view; otherwise, doc://com.apple.documentation/documentation/Swift/false. If doc://com.apple.documentation/documentation/Swift/true and one of the custom views of the doc://com.apple.uikit/documentation/UIKit/UIViewController/navigationItem property is set to the value returned by the doc://com.apple.uikit/documentation/UIKit/UIViewController/editButtonItem method, the associated navigation controller displays a Done button; otherwise, an Edit button.
- `animated`: If doc://com.apple.documentation/documentation/Swift/true, animates the transition; otherwise, does not.

## Discussion

Discussion Subclasses that use an edit-done button must override this method to change their view to an editable state if isEditing is true and a non-editable state if it is false. This method should invoke super’s implementation before updating its view.

## See Also

### Adding editing behaviors to your view controller

- [isEditing](uikit/uiviewcontroller/isediting.md)
- [editButtonItem](uikit/uiviewcontroller/editbuttonitem.md)
