In the Swift Tutorial - Developing iOS 8 Apps, Part 1 by Jameson Quave ... using Storyboards in Xcode Version 7.0 beta (7A121l) ... there's a part where I set up a delegate and data source for the table view. The instructions say to just hold control, and then click and drag from the tableview to the "View Controller" object in our storyboard's hierarchy, and select 'data source'; then repeat for this for the 'delegate' option.
This creates two Outlets:
dataSource -> View Controller
delegate - > View Controller
in the connections inspector.
I then add protocols to the ViewController class:
class VIewController: UIViewController, UITableViewDataSource, UITableViewDelegate { ...
and then modify the View Controller class by adding the correct functions (i.e., implementation).
The question I have is why aren't these outlets reflected back into the code of my View Contoller?
Something like:
@IBOutlet weak var SomeName: SomeType!
Is this a bug in the beta 7.0 version of Xcode? Or is this code not supposed to be seen inside this ViewController class?
Here is an example of the code as it stands with the @IBOutlet weak var SomeName: SomeType!, outlet code missing (At least, it is the code I believe is missing, and should be include to explain what's happening inside Interface Builder (IB)???:
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "MyTestCell")
cell.textLabel?.text = "Row #\(indexPath.row)"
cell.detailTextLabel?.text = "Subtitle #\(indexPath.row)"
return cell
}
}