---
title: "unregisterForPreviewing(withContext:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/unregisterforpreviewing(withcontext:)"
---

# unregisterForPreviewing(withContext:)

Unregisters a previously registered view controller identified by its context object.

## Declaration

```swift
func unregisterForPreviewing(withContext previewing: any UIViewControllerPreviewing)
```

## Parameters

- `previewing`: The context object that was returned when you registered the view controller by calling the doc://com.apple.uikit/documentation/UIKit/UIViewController/registerForPreviewing(with:sourceView:) method.

## Discussion

Discussion The system calls this method automatically when a 3D Touch-registered view controller is deallocated. In some circumstances, you must explicitly call this method. This is the case if a registered view controller’s view hierarchy changes state, or if presenting a preview is otherwise no longer possible. In such cases, call this method.

## See Also

### Deprecated methods

- [setOverrideTraitCollection(_:forChild:)](uikit/uiviewcontroller/setoverridetraitcollection(_:forchild:).md)
- [overrideTraitCollection(forChild:)](uikit/uiviewcontroller/overridetraitcollection(forchild:).md)
- [attemptRotationToDeviceOrientation()](uikit/uiviewcontroller/attemptrotationtodeviceorientation().md)
- [registerForPreviewing(with:sourceView:)](uikit/uiviewcontroller/registerforpreviewing(with:sourceview:).md)
- [canPerformUnwindSegueAction(_:from:withSender:)](uikit/uiviewcontroller/canperformunwindsegueaction(_:from:withsender:).md)
- [didRotate(from:)](uikit/uiviewcontroller/didrotate(from:).md)
- [dismissMoviePlayerViewControllerAnimated()](uikit/uiviewcontroller/dismissmovieplayerviewcontrolleranimated().md)
- [forUnwindSegueAction(_:from:withSender:)](uikit/uiviewcontroller/forunwindsegueaction(_:from:withsender:).md)
- [presentMoviePlayerViewControllerAnimated(_:)](uikit/uiviewcontroller/presentmovieplayerviewcontrolleranimated(_:).md)
- [rotatingFooterView()](uikit/uiviewcontroller/rotatingfooterview().md)
- [rotatingHeaderView()](uikit/uiviewcontroller/rotatingheaderview().md)
- [segueForUnwinding(to:from:identifier:)](uikit/uiviewcontroller/segueforunwinding(to:from:identifier:).md)
- [shouldAutomaticallyForwardRotationMethods()](uikit/uiviewcontroller/shouldautomaticallyforwardrotationmethods().md)
- [willAnimateRotation(to:duration:)](uikit/uiviewcontroller/willanimaterotation(to:duration:).md)
- [willRotate(to:duration:)](uikit/uiviewcontroller/willrotate(to:duration:).md)
