Learn Courses My Dashboard

Disclosure accessory performing different segue to cell tap

Hi all.

Getting started with app development and the CWC videos have been really helpful - so I thought this would be a great place to get encouragement, ideas, and help.

I’ve been searching for the solution to this issue, but no success.

I have a kind of nested data model where I have an array of venues, and each venue contains an array of product sold.

Venues are listed in a Table View Controller where a click on either the cell or an Add bar button opens the Add/Edit venue static table controller - as in many apple labs.

However, I need another event/interaction to open another Table View Controller that lists the products in the sub-array.

I was thinking I could use the disclosure accessory to show this Table View, and I’ve been attempting to implement accessoryButtonTappedForRowWith method - with no luck, clicking the disclosure indicator behaves the same as clicking the cell.

My question is two-fold. 1) is this an acceptable UX (or should I do it another way) and 2) if this is acceptable, what are the steps to implement it?

Currently, I have the method declared as follows:

override func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
        let selectedVenue = venues[indexPath.row]
            performSegue(withIdentifier: "ShowProductsList", sender: selectedVenue)

and, by right clicking on the cell in the storyboard I was able to create a segue from accessory action to the Products Table View Controller with the identifier ShowProductsList.

Thank you for any help resolving this issue or pointing me in a better direction.