Ну вот так вот.
import UIKit
class SomeViewController: UIViewController {
@IBOutlet var myLable: UILabel!
var someValue: String = "ноль"
override func viewDidLoad() {
super.viewDidLoad()
myLable.text = someValue
}
}
class NextTableViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate {
let array = ["один", "два", "три"]
let sequeIdentifiers = "go"
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let selected = indexPath.row
self.performSegueWithIdentifier(sequeIdentifiers, sender: selected)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let destControl = segue.destinationViewController as SomeViewController
if let indexFromSender: Int = sender?.integerValue{
destControl.someValue = array[indexFromSender]
}
else{println("Not Integer")}
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return array.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
var cell: UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) as? UITableViewCell
if cell == nil{
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: cellIdentifier)
}
cell!.textLabel?.text = array[indexPath.row]
return cell!
}
}