<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/setEditing(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)setEditing:animated:"
  },
  "title" : "setEditing(_:animated:)"
}
-->

# setEditing(_:animated:)

Sets whether the view controller shows an editable view.

```
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 [`navigationItem`](/documentation/UIKit/UIViewController/navigationItem)     property is set to the value returned by the [`editButtonItem`](/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

Subclasses that use an edit-done button must override this method to change their view to an editable state if [`isEditing`](/documentation/UIKit/UIViewController/isEditing) is <doc://com.apple.documentation/documentation/Swift/true> and a non-editable state if it is <doc://com.apple.documentation/documentation/Swift/false>. This method should invoke super’s implementation before updating its view.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)