Latest 0.1.3
Homepage https://github.com/tungvoduc/DTContainerController
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

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.

Screenshot

Screenshot

Usage

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
containerController.show(childViewController, animated: false, completion: nil)

// Present a new child view controller and destroy current child view controller with transition
containerController.show(childViewController, 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)

Example

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

Requirements

iOS 8.3+

Installation

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

pod 'DTContainerController'

Author

tungvoduc, [email protected]

License

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

Latest podspec

{
    "name": "DTContainerController",
    "version": "0.1.3",
    "summary": "A simple container to handle transitioning between two view controllers, written in Swift.",
    "swift_version": "4.2",
    "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": "https://github.com/tungvoduc/DTContainerController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "tungvoduc": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tungvoduc/DTContainerController.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DTContainerController/Classes/**/*"
}

Pin It on Pinterest

Share This