Ich muss diesen String-Wert an einen anderen ViewController übergeben. Aus irgendeinem Grund bekomme ich einen Fehler. Kann jemand darauf hinweisen, was ich falsch mache?Passing String Segue Swift
Need Viewcontroller
class GeneralChatroom: UIViewController, UITableViewDataSource, UITableViewDelegate, UITextFieldDelegate, UITextViewDelegate {
//Get Data of current cell that has been tapped
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
//Eliminate highlight after cell is tapped
tableView.deselectRow(at: indexPath as IndexPath, animated: true)
let userIdentityString : String = generalRoomDataArr[indexPath.row].cellUserId
let destinationUID = userCellTapped()
destinationUID.programVar = userIdentityString
destinationUID.performSegue(withIdentifier: "profileTapped", sender: self)
}
}
import UIKit
class userCellTapped: UIViewController {
var programVar : String!
override func viewDidLoad() {
super.viewDidLoad()
print("testbles", programVar)
}
}
Mögliche Duplikat [Geben von Daten zwischen View-Controller] (http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – pableiros