Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/Loaf/Presenter/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ final class Controller: UIPresentationController {
containerInsets = UIEdgeInsets(top: min(statusBarSize.width, statusBarSize.height), left: 0, bottom: 0, right: 0)
}

if let tabBar = loaf.sender?.parent as? UITabBarController{
if let tabBar = loaf.sender?.parent as? UITabBarController {
containerInsets.bottom += tabBar.tabBar.frame.height
} else if let tabBar = loaf.sender?.parent?.parent as? UITabBarController {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also check if the loaf.sender?.parent is a UINavigationController here, because I worry that the "parent's parent" might be a screen that is hidden from the current view. How does this look?

Suggested change
} else if let tabBar = loaf.sender?.parent?.parent as? UITabBarController {
} else if let navController = loaf.sender?.parent as? UINavigationController, let tabBar = navController.parent as? UITabBarController {

containerInsets.bottom += tabBar.tabBar.frame.height
}

Expand Down