Latest 1.0.1
License MIT
Platforms ios 8.0

CI Status

DTContainerController is a view controller container written in Swift.

Why DTContainerController?

There are cases where you want to present a new view controller and destroy the current view controller. The most applicable cases are when user goes through onboarding phase and logs into the app or when user logs out from the app to log-in view. In these cases, the new view controller are presented and there is no reasons to keep old view controller alive, this cannot be done by using present(_:animated:completion:) since the presenting view controller still exists after presentation. This is why DTContainerController becomes handy.

DTContainerController should usually be used as the root view controller of the application window.




DTContainerController has at most one child view controller. In order to set the child view controller or replace the current child view controller with animation, you can use:

// Set or replace current view controller without animation, animated: false, completion: nil)

// Present a new child view controller and destroy current child view controller with transition, animated: true, completion: nil)

Accessing container controller ancestor is similar to navigationController or tabbarController:

// Access parent container controller and present a new view controller
self.containerViewController?.show(childViewController, animated: true, completion: nil)


To run the example project, clone the repo, and run pod install from the Example directory first.


iOS 8.3+


DTContainerController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DTContainerController'


Tung Vo, [email protected]


DTContainerController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "DTContainerController",
    "version": "1.0.1",
    "summary": "A simple container to handle transitioning between two view controllers, written in Swift.",
    "swift_version": "5.0",
    "description": "TODO: Add long description of the pod here.nA Swift view controller container to handle transitioning between two view controllers.nDTContainerController contains a current view controller that, when transiting to a new current view controller, is destroyed.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "tungvoduc": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "platforms": {
        "ios": "8.0"
    "source_files": "DTContainerController/Classes/**/*"

Pin It on Pinterest

Share This