#StackBounty: #ios #swift #xcode #segue Manual (automatic) Segue not working – table view cell

Bounty: 400

I’m new to Xcode and I’m following the tutorial here which goes through how to add a manual segue.


Problem: When clicking on a table cell in the simulator the manual segue is not triggered.

What I’ve tried: I’ve added a manual (automatic) segue, an identifier, and whilst the tutorial says as this point a selection of a cell with result in going from the table view cell to the meal detail scene, I’ve continued to the code part and my breakpoint in prepare still does not trigger.

    // MARK: - Navigation

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        super.prepare(for: segue, sender: sender)
        switch(segue.identifier ?? "") {
        case "AddItem":
            os_log("Adding a new meal", log: OSLog.default, type: .debug)
        case "ShowDetail":
            // set the meal for the `MealViewController` as the meal selected in the `MealTableViewController`
            os_log("Show detail of a meal", log: OSLog.default, type: .debug)
            guard let mealDetailViewController = segue.destination as? MealViewController else {
                fatalError("Unexpected destination, (segue.destination)")
            guard let selectedMealCell = sender as? MealTableViewCell else {
                fatalError("Unexpected sender, (String(describing: sender))")
            guard let indexPath = tableView.indexPath(for: selectedMealCell) else {
                fatalError("The selected cell is not being displayed by the table")
            let selectedMeal = meals[indexPath.row]
            mealDetailViewController.meal = selectedMeal
            fatalError("Unexpected Segue Identifier")

Checks made:
If, for the purposes of debugging only, I put the following in my MealTableViewController.swift with a breakpoint nothing happens when I click a table cell:

    override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
        return true

This makes me think the table cells aren’t registering a ‘selection’.

Table View Selection property is Single Selection.

The custom MealTableViewCell has User Interaction Enabled checked.

Clicking the MealTableViewCell in the outline pane and selecting the Connections inspector in the utilities pane also shows the segue:

Connections Inspector showing segue

Final bits: Is it still possible to add a manual (automatic) segue?
Tutorial is in archive and I’ve managed to follow most of it with small changes.
Using Xcode 11.6

main.storyboard and Identity Inspector

Edit(s) / answers to comment questions:

  1. added (automatic) to manual. I mean the method the tutorial uses from table cell to meal detail.
  2. There isn’t anything in front of the table (that I’m aware of) such as a tap gesture recogniser
  3. The Plus segue works and triggers the prepare unlike clicking a table cell

Get this bounty!!!

#StackBounty: #ios #swift #delegates #segue #protocols Protocol delegate between view before navigation stack

Bounty: 50

View1 segues to Navigation ControllerView2 segues to View3

I am trying to create protocol delegate from View3 to View1

In View1

class NormalUser: UIViewController, NormalUserDelegate {

   @objc func showAddressView() {

        addressView.isHidden = false

override func viewDidLoad() {

        if let conn = self.storyboard?.instantiateViewController(withIdentifier: "View") as? View
          conn.delegate = self

In View3

weak var delegate: NormalUserDelegate?

func test() {




protocol NormalUserDelegate: class {
    func showAddressView()

I couldn’t make it work. Any idea?

Get this bounty!!!

#StackBounty: #ios #swift #segue View Controller disappearing after Segue

Bounty: 50

I have a customer tab controller that has a custom icon that when a user clicks a popup menu comes up with 3 choices. When I click the first option it should take me to a new view controller, however when I click it the view controller only appears for a second before disappearing again. I’m not sure why but here is my code for the customer tab bar:

import UIKit
import PopMenu

class TabBarController: UITabBarController, UITabBarControllerDelegate {

    override func viewDidLoad() {
        delegate = self


    func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
        if viewController.title == "for custom action" {
            let manager = PopMenuManager.default

            let action1 = PopMenuDefaultAction(title: "Scan Barcode", didSelect: { action in

            self.performSegue(withIdentifier: "showScanBarcode", sender: nil)

            print("(String(describing: action.title)) is tapped")


        let action2 = PopMenuDefaultAction(title: "Action 2", didSelect: { action in

            print("(String(describing: action.title)) is tapped")

        let action3 = PopMenuDefaultAction(title: "Action 3", image: UIImage(named: "wine"), didSelect: { action in
            print("(String(describing: action.title)) is tapped")



        return false
    return true

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "mySegue" {

        let controller = segue.destination as! myViewController

        controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
        controller.navigationItem.leftItemsSupplementBackButton = true



Here is an image showing the flow. User clicks the camera button, then a popup menu appears and when the user clicks on an option I want to take them to a new view controller (not connected to tab bar controller). I setup the first link to go to a new view controller, and it shows for a few seconds then disappears.

enter image description here

Get this bounty!!!