0

I attempted to set modalPresentationStyle to .fullscreen following the Apple Documentation.

After setting the modalPresentationStyle to .fullscreen shown in the code below, the system still presents the viewControllers in UIModalPresentationStyle.automatic "the system default"

//Presentation Style
let homeVC = HomeController(viewModel: viewModel)
homeVC.modalPresentationStyle = UIModalPresentationStyle.fullScreen

A framework called XCoordinator controls navigation within this application, here is an example on how it is done.

switch route { 
case .home: 

let viewModel = HomeViewModelImpl(router: anyRouter) 
let viewController = HomeController(viewModel: viewModel) 

return .push(viewController)

}
Joshua
  • 481
  • 6
  • 21
  • Define "not working". [Edit] your question with more specific details. – rmaddy Oct 08 '19 at 19:12
  • @rmaddy updated – Joshua Oct 08 '19 at 19:15
  • are you sure it'snot being set in a storyboard / xib ? – Nitin Alabur Oct 08 '19 at 19:16
  • @NitinAlabur Yep! The project uses view controllers created programmatically , the storyboard is not in play here – Joshua Oct 08 '19 at 19:19
  • Are you presenting `homeVC` itself or a view controller that contains `homeVC` (like a navigation controller, for example)? What does your code look like where you do the actual presentation? – TylerP Oct 08 '19 at 19:31
  • @TylerTheCompiler views are pushed on the stack using a framework called XCoordinator like so `switch route { case .home: let viewModel = HomeViewModelImpl(router: anyRouter) let viewController = HomeController(viewModel: viewModel) return .push(viewController)` – Joshua Oct 08 '19 at 19:40
  • 2
    I've never used XCoordinator but taking a quick look at the documentation and I see `.push` will just push it onto the navigation stack so I doubt that will ever be modal. I suggest maybe looking into `.present` instead. As I said I haven't used it but that would be my guess. Whichever way you look at it though you have given control of presentation over to XCoordinator so the issue lies there. – Upholder Of Truth Oct 08 '19 at 19:49
  • 1
    @Joshua Do not put details in comments. Please [edit] your question with all relevant details. – rmaddy Oct 08 '19 at 20:28
  • @UpholderOfTruth Thanks for the help! Greatly appreciated – Joshua Oct 08 '19 at 21:10
  • @rmaddy Updated the question with the details, sorry about that . – Joshua Oct 08 '19 at 21:53

1 Answers1

0

The TabBarCoordinator has a rootViewController when XCoordinator is setup.

The solution here was to set the .modalPresentationStyle to .fullscreen off of the rootViewController .

rootViewController.modalPresentationStyle = .fullscreen

Please note this has to be called after any super method in your class file

Joshua
  • 481
  • 6
  • 21