Latest 1.1
License MIT
Platforms ios 11.0

Carthage compatible

DYModalNavigationController is a simple UINavigationController subclass written in Swift 5.0. Use cases:

  • present a small size view controller with rounded edges over the current context modally (e.g. if the content is rather small and the standard modal presentation would show a lot of empty space). Set a fixed size so that the navigation controller’s size is not adjusted when the screen orientation changes.
  • present a modal view controller over the current context with top, bottom, left, right margins with a fade in transition. The presenting view controller behind it is still visible at the margins (unless margins set to 0). The size adjusts automatically when the screen orientation changes.

Example project

To checkout the example project, simply clone the repo or download the zip file.


  • Create a DYModalNavigationController with a fixed size in case your view controller instance should not change its size when changing the screen orientation.
  • Set a background blur or dim effect
  • Customise the corner radius of the DYModalNavigationController view.
  • Set a slide in/out animation (customisable animation movement directions) or a fade in/out animation
  • Customise the drop shadow
  • Customise the animation transition duration


Installation through Cocoapods or Carthage is recommended.


target ‘[project name]’ do
pod ‘DYModalNavigationController’, ‘~> 1.0

Carthage: Simply add the following line to your Cartfile.

github "DominikButz/DYModalNavigationController" ~> 1.0

Check out the version history below for the current version.

Afterwards, run "carthage update DYModalNavigationController –platform iOS" in the root directory of your project. Follow the steps described in the carthage project on github (click on the carthage compatible shield above).

Make sure to import DYModalNavigationController into your View Controller subclass:

import DYModalNavigationController


Check out the following examples.

Code example: Fixed size DYModalNavigationController with background blur

   let size = CGSize(width: 300, height: 200)
   var settings = DYModalNavigationControllerSettings()
       settings.slideInDirection = .right
   settings.slideOutDirection = .right
   settings.backgroundEffect = .blur
   self.navController = DYModalNavigationController(rootViewController:             contentVC(), fixedSize: size, settings: settings)

DYModalNavigationController example

Code example: DYModalNavigationController with margins and fade effect

   var settings = DYModalNavigationControllerSettings()
        settings.animationType  = .fadeInOut
        // animationType .slideInOut is default setting!
   self.navController = DYModalNavigationController(rootViewController:             contentVC(), fixedSize: nil, settings: settings)
   // with fixedSize nil, the size will be set according to the top, bottom,            left, right margins in the settings. 

DYModalNavigationController example

Code example: DYModalNavigationController with custom animations

   var settings = DYModalNavigationControllerSettings()
        settings.animationType = .custom
   self.navController = DYModalNavigationController(rootViewController:             contentVC(), fixedSize: size, settings: settings, customPresentationAnimation: { (transitionContext) in

   self.foldOut(transitionContext: transitionContext, navController: self.navController)

       }, customDismissalAnimation: { (transitionContext) in

    self.foldIn(transitionContext: transitionContext, navController: self.navController)


DYModalNavigationController example

Change log

Version 1.0

initial version.

Version 1.1

added customPresentationAnimation and customDismissalAnimation to the initializer.


[email protected]


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

Latest podspec

    "name": "DYModalNavigationController",
    "version": "1.1",
    "summary": "UINavigationController subclass with support for custom size and present and dismiss animations.",
    "swift_versions": "5.0",
    "description": "UINavigationController subclass that supports setting a custom size and slide in/out and fade in/out animations.nPresented over the "current context".",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "dominikbutz": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1"
    "platforms": {
        "ios": "11.0"
    "source_files": "DYModalNavigationController/**/*",
    "exclude_files": "DYModalNavigationController/**/*.plist",
    "public_header_files": "DYModalNavigationController/**/*.h"

Pin It on Pinterest

Share This