Use Segmented Control with TabBarController without TabBar (bottom) disappears


I want to use Segmented Control to choice between contact form and contact details in the contact ViewController in my app. The contact ViewController is managed by the TabBarController. But when switching by using the Segmented Control the TabBar on the bottom disappears.

I uploaded a sample project here: SegmentedControlTest

Is there a simple way to solve that issue?

Regards, David.

Keeping the current structure you can:

  1. Embed ContactFormVC in NavigationController (editor -> embed in -> NavigationController) and on the NavigationController property uncheck "Shows Navigation Bar"
  2. On both ContactFormVC and ContactDetailsVC set its "presentation" property (under "Transition Style") to "Current Context"; Your storyboard will look like this

You should change your transition to push and pop instead of both "show" otherwise you'll keep adding on the navigation stack. It's easy to do via code, I can't find how to do this via storyboard. I also recommend changing the structure for your view controllers as suggested by previous answer.

The way I encourage you to do is to use single view controller with multiple container views.

*Connecting .swift code to storyboard. Make sure the class name on custom class section is the same as the class' name. In this case it's "ViewController.swift"