How to fix the SIGABRT error - ios

So I was building a table view largely based off this apple tutorial Create a Table View but ran in to a problem when running my app. The problem was that when I ran the application, I received the much dreaded SIGABRT error.
Note 1: I only get the SIGABRT error when loadlist() is in ViewDidLoad
So I added an exemption breakpoint and got this error:
objc[7603]: Class STGenericIntentDateRange is implemented in both /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/SiriTasks.framework/SiriTasks and /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/PhotosUI.framework/PhotosUI. One of the two will be used. Which one is undefined.
objc[7603]: Class GKStateMachine is implemented in both /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/GameCenterFoundation.framework/GameCenterFoundation and /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/GameplayKit.framework/GameplayKit. One of the two will be used. Which one is undefined.
(lldb)
For the record, my TableViewController looked like this:
import UIKit
class LevelTableViewController: UITableViewController {
var levelsArray = [Level]()
override func viewDidLoad() {
super.viewDidLoad()
//Load the data
loadlist()
}
func loadlist(){
let Level1:Level = Level(name: "Level1")!
levelsArray += [Level1]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return levelsArray.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellid = "LevelTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellid, forIndexPath: indexPath) as! LevelTableViewCell
// Fetches the appropriate meal for the data source layout.
let Level = levelsArray[indexPath.row]
cell.ListName.text = Level.name
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
And my TableViewCell like this:
import UIKit
class LevelTableViewCell: UITableViewCell {
//Declaration of properties
#IBOutlet weak var ListName: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
And my class definition like this:
import Foundation
import UIKit
class Level {
// MARK: Properties
var name: String
init?(name: String) {
// Initialize stored properties.
self.name = name
if name.isEmpty {
return nil
}
}
}
Help would be greatly appreciated.

Check if those classes are duplicated as they could be in both frameworks. If they are duplicated but barely different, you "might" try deleting one version and adding them again with a different name. Be aware this option might need several changes as these classes could be called from more points in the code.
If the classes are identical, try finding them with Finder, make a copy, delete them from your project navigator and try again. If something goes terribly wrong, just add them again to your project and don't forget to check "Copy items"

Related

Displaying Data from Firebase in TableView Cell

I have the following code in one of my VC's (as part of my larger project). One of my Firebase DB references is called Sell_Request. It has three children (name, latitude and longitude), but I'm only concerned with name for right now.
I am trying to add it to a String array and am also printing it to the console. I am seeing the names being printed to the console, but I'm not getting the names printed in the individual cells.
Thanks for looking.
import UIKit
import Firebase
import FirebaseDatabase
import MapKit
import CoreLocation
class RequestVC: UITableViewController, CLLocationManagerDelegate {
var locationManager = CLLocationManager()
var sellerUserNames = [String]()
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "backToMain" {
self.navigationController?.navigationBar.isHidden = true
}
}
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = manager.location?.coordinate {
let databaseRef = FIRDatabase.database().reference()
databaseRef.child("Sell_Request").queryOrderedByKey().observe(.childAdded, with: { (FIRDataSnapshot) in
if let data = FIRDataSnapshot.value as? NSDictionary {
if let name = data[Constants.NAME] as? String {
self.sellerUserNames.append(name)
print(name)
}
}
})
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return sellerUserNames.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = sellerUserNames[indexPath.row]
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
You just need to call tableView.reloadData() after you append the name to the sellerUserNames array, change your function to this...
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = manager.location?.coordinate {
let databaseRef = FIRDatabase.database().reference()
sellerUserNames.removeAll()
databaseRef.child("Sell_Request").queryOrderedByKey().observe(.childAdded, with: { (FIRDataSnapshot) in
if let data = FIRDataSnapshot.value as? NSDictionary {
if let name = data[Constants.NAME] as? String {
self.sellerUserNames.append(name)
print(name)
self.tableView.reloadData()
}
}
})
}
}
Edit
where/when you want to call sellerUserNames.removeAll() depends on your code and the life cycle of your table view, but I have edited my code above to add it in where it is most likely appropriate.
TableView need to reload after data source has changes i.e sellerUserNames in your code. So after you append the name to sellerUserNames, you need to reload the tableview.
Add this line of code after you append the name.
self.tableView.reloadData()

Table View Data Source not showing all the rows

I am a seasoned web and Android developer and am teaching myself iPhone development on my MacBook running xCode 8.2 using the book Beginning iPhone Development with Swift 2. I am running into issues converting the examples in the book to Swift 3, but have been able to deal with most of them.
The tables are not going well, however. I have converted all of the methods I can figure out, but I can't get all of the table data to show on any of the examples. Here is my code:
//
// RootViewController.swift
// Fonts
//
// Created by Thomas Hehl on 12/21/16.
//
import UIKit
class RootViewController: UITableViewController {
private var familyNames: [String]!
private var cellPointSize: CGFloat!
private var favoritesList: FavoritesList!
private static let familyCell = "FamilyName"
private static let favoritesCell = "Favorites"
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
familyNames = (UIFont.familyNames as [String]).sorted()
let preferredTableViewFont = UIFont.preferredFont(forTextStyle: UIFontTextStyle.headline)
cellPointSize = preferredTableViewFont.pointSize
favoritesList = FavoritesList.sharedFavoritesList
tableView.estimatedRowHeight = cellPointSize
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tableView.reloadData()
}
func fontForDisplay(atIndexPath indexPath: NSIndexPath) -> UIFont? {
if indexPath.section == 0 {
let familyName = familyNames[ indexPath.row]
let fontName = UIFont.fontNames(forFamilyName: familyName).first
return fontName != nil ? UIFont(name: fontName!, size: cellPointSize) : nil
} else {
return nil
}
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// return the number of sections
return favoritesList.favorites.isEmpty ? 1 : 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return section == 0 ? familyNames.count : 1
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return section == 0 ? "All Font Families" : "My Favorite Fonts"
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
// the font names list
let cell = tableView.dequeueReusableCell(withIdentifier: RootViewController.familyCell, for: indexPath)
cell.textLabel?.font = fontForDisplay(atIndexPath: indexPath as NSIndexPath)
cell.textLabel?.text = familyNames[indexPath.row]
cell.detailTextLabel?.text = familyNames[indexPath.row]
return cell
} else {
//the favorites list
return tableView.dequeueReusableCell(withIdentifier: RootViewController.favoritesCell, for: indexPath)
}
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
Unfortunately, even though that familyNames contains 75 entries, the table is only showing the first screenful. Here is the screenshot.
As you can see, the scrollbar's all the way at the bottom, but that's not nearly all of the fonts.
[EDIT - After chat, it appears the problem is merely that the OP doesn't know how to scroll. The OP sent me the actual project, I ran it, and it works just fine.]
Your code works fine. I literally just copied and pasted your code into the Master-Detail template, made a few adjustments (commenting out the second section stuff because you didn't supply any info about it), and got this:

Table View only loads if I put phone in landscape mode

I have a custom table view, which when I run the app, shows up blank, like it hasnt been loaded, but when I tilt my phone to landscape mode, the entries appear, which really doesnt make sense to me. Any suggestions?
Edit: Here is my code
import UIKit
import Alamofire
import ObjectMapper
class LotteryTableViewController: UITableViewController {
let lotteryMachine = LotteryMachine()
var currentStandings: [Team] = []
var draftStandings: [Team] = []
override func viewDidLoad() {
super.viewDidLoad()
let headers = [
"User-agent": "LotteryMachine/1.0 (nilayneeranjun24#gmail.com)",
]
Alamofire.request(.GET, "https://erikberg.com/nba/standings.json",headers: headers)
.responseJSON { response in
let parentJson = Mapper<Standings>().map(response.2.value)
let standingsArray: [Team] = parentJson!.standing!
self.currentStandings=standingsArray
self.draftStandings=self.lotteryMachine.setPossibleCombinations(standingsArray)
self.draftStandings=self.lotteryMachine.setDraftPositions(self.draftStandings)
print (self.draftStandings.toJSON())
}
}
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return draftStandings.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "LotteryTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! LotteryTableViewCell
let position = self.draftStandings[indexPath.row].draftingPosition!
let teamName = self.draftStandings[indexPath.row].lastName!
let record = String(self.draftStandings[indexPath.row].won!) + "-" + String(self.draftStandings[indexPath.row].lost!)
let player = "Ben Simmons"
cell.position.text = String(position)
cell.teamName.text = teamName
cell.record.text = String(record)
cell.player.text = player
cell.teamLogo.image = UIImage(named: "lakers")
// Configure the cell...
return cell
}
/*
// Override to support conditional editing of the table view.
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == .Delete {
// Delete the row from the data source
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
Alamofire.request is async in nature. So when the table first loads, the request is still executing and your draftStandings doesn't have any data. When you rotate, the table is reloaded and by that time draftStandings does have some data already which the table shows.
Try adding a tableView.reloadData() after setting the draftStandings in the request response.

Display 2nd 'column' value of array in separate screen based on selected row in swift

I just started to learn swift and trying to make a simple app in which I have created a UITableView with terms
('Term 1' till 'Term 15') and want to display a detail description of the term
('Detail 1' till 'Detail 15') when selected in the table in a separate view.
Using the available online tutorials, I've created the code below but have difficulties to complete and am only able to display a fixed string.
Any suggestions how best to proceed are welcome:
import UIKit
class FirstTableViewController: UITableViewController{
let Datasource = [("Term 1","Detail 1"),("Term 2","Detail 2"),("Term 3","Detail 3"),("Term 4","Detail 4"),("Term 5","Detail 5"),("Term 6","Detail 6"),("Term 7","Detail 7"),("Term 8","Detail 8"),("Term 9","Detail 9"),("Term 10","Detail 10"),("Term 11","Detail 11"),("Term 12","Detail 12"),("Term 13","Detail 13"),("Term 14","Detail 14"),("Term 15","Detail 15")]
//MARK -> Table Structure
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.Datasource.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var Cell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
var (Id, Detail) = Datasource[indexPath.row]
Cell.textLabel?.text = Id
return Cell
}
//MARK -> Link to view term details on seperate screen
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var DestinationViewController = segue.destinationViewController as! DetailedTableViewController
DestinationViewController.DetailedTerm = "DISPLAY 2ND COLUMN OF DATASOURCE ARREY"
}
//MARK -> Standard methods
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

delegate modal view swift

I have tried the other methods for delegation and protocols for passing data between modal views and the parent view button they aren't working for me. This is obviously because I am implementing them wrong.
What I have is a parent view controller which has a tableviewcell which in the right detail will tell you your selection from the modal view. The modal view is another table view which allows you to select a cell, which updates the right detail and dismisses the modal view. All is working except the actual data transfer.
Thanks in advance!! :)
Here is my code for the parent view controller:
class TableViewController: UITableViewController, UITextFieldDelegate {
//Properties
var delegate: transferData?
//Outlets
#IBOutlet var productLabel: UILabel!
#IBOutlet var rightDetail: UILabel!
override func viewWillAppear(animated: Bool) {
println(delegate?.productCarrier)
println(delegate?.priceCarrier)
if delegate?.productCarrier != "" {
rightDetail.text = delegate?.productCarrier
productLabel.text = delegate?.productCarrier
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 5
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 1
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
}
The code for the model view controller and protocol is:
protocol transferData {
var priceCarrier: Double { get set }
var productCarrier: String { get set }
}
class ProductsDetailsViewController: UITableViewController, transferData {
//Properties
var priceCarrier = 00.00
var productCarrier = ""
//Outlets
//Actions
#IBAction func unwindToViewController(segue: UIStoryboardSegue) {
self.dismissViewControllerAnimated(true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
populateDefaultCategories()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return Int(Category.allObjects().count)
}
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return (Category.allObjects()[UInt(section)] as Category).name
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return Int(objectsForSection(section).count)
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:ProductListCell = tableView.dequeueReusableCellWithIdentifier("productCell", forIndexPath: indexPath) as ProductListCell
let queriedProductResult = objectForProductFromSection(indexPath.section, indexPath.row)
cell.name.text = queriedProductResult.name
cell.prices.text = "$\(queriedProductResult.price)"
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = self.tableView.indexPathForSelectedRow()!
let product = objectForProductFromSection(indexPath.section, indexPath.row)
let PVC: TableViewController = TableViewController()
println("didSelect")
productCarrier = product.name
priceCarrier = product.price
println(productCarrier)
println(priceCarrier)
self.dismissViewControllerAnimated(true, completion: nil)
}
I think for passing data, you should use segue like:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = self.tableView.indexPathForSelectedRow()!
let product = objectForProductFromSection(indexPath.section, indexPath.row)
println("didSelect")
productCarrier = product.name
priceCarrier = product.price
println(productCarrier)
println(priceCarrier)
self.performSegueWithIdentifier("displayYourTableViewControllerSegue", sender: self)
}
and then override the prepareForSegue function:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var controller = segue.destinationViewController as TableViewController
controller.rightDetail.text = "\(self.priceCarrier)"
controller.productLabel.text = self.productCarrier
}

Resources