'Navigation to ViewController via Push Segue opens screen then immediately closes it

I have a SearchViewController that contains a UITableView that presents articles.

When pressing on an article, a navigation with segue command is called and the user is moved to the ArticleViewController screen so he can read the article.

For some reason, after the article screen is opened (you can see all the populated ui elements inside) it immediately closes and the user is back again in the search screen.

The navigation command is:

func actionButtonDidPress(inside article: Article) {
        selectedArticle = article
        self.performSegue(withIdentifier: Constants.Segues.SEARCH_TO_ARTICLE, sender: self)
    }
    
    override func prepare( for segue: UIStoryboardSegue, sender: Any? ) {
        if let selectedArticle = selectedArticle {
            if segue.identifier == Constants.Segues.SEARCH_TO_ARTICLE {
                let destinationVC = segue.destination as! ArticleViewController
                destinationVC.currentArticle = selectedArticle
            }
        }
    }

I don't think it is something inside the ArticleViewController because when I do the same procedure from the HomepageViewController (table view with articles -> press on an article navigates to the article page) everything works with no issue.

Both times I use a Show segue and send the same elements into the ArticleViewController.

What can be causing this issue?

(When I switched to a Present Modally segue it solves the issue, but then I lose the TabBar that is supposed to be presented or lose other functionalities that are needed so I don't want this workaround)



Solution 1:[1]

Couldn't find a solution so eventually just switched all my segues in the app from "show" to "Present Modally" with "Presentation: Over Current Context" because this is the one that did work for the screen and was the closest in look to what I needed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Noam Kurtzer