@IBOutlets not appearing in code?

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

}

}

You won't see those outlets in your code because they belong to the table view that you inserted into the view controller. Essentially, you are telling the table view that its delegate and data source are the view controller.

Thank you for the answer, donarb. So I take it means that I must understand that the underlying classes, such as UITableViewDataSource, UITableViewDelegate are being associated with the dataSource and delegate outlets as described in the connections inspector. And that I've not yet looked at the table view code, but rather I've shown the incorrect view controller code in my example.


Is it possible to locate this table view code? With storyboards, I see the View as a diagram but there doesn't seem to be any code available to read? Is the pop-up box that goes with the View, giving outlet connections and referencing outlets, a replacement for this code as per the Interface Builder's design?


In otherwords I'm having dificutlty understanding how the code and the graphical interface are playing together as it applies to setting @IBOutlet in Interface Builder (IB). Are there any resources that may give insight into this design aspect of IB, as I have found the Xcode documenation to be rather vague about this topic?


Possible answer using the Assistant Editor:


class UITableView : UIScrollView {


init(frame: CGRect, style: UITableViewStyle) /

init(coder aDecoder: NSCoder)


var style: UITableViewStyle { get }

weak var dataSource: UITableViewDataSource? // But what has happen to the @IBOutlet notation?

weak var delegate: UITableViewDelegate? // But what has happen to the @IBOutlet notation?

var rowHeight: CGFloat /

var sectionHeaderHeight: CGFloat /

var sectionFooterHeight: CGFloat /

@available(iOS 7.0, *)

var estimatedRowHeight: CGFloat /

@available(iOS 7.0, *)

var estimatedSectionHeaderHeight: CGFloat /

@available(iOS 7.0, *)

var estimatedSectionFooterHeight: CGFloat /

@available(iOS 7.0, *)

var separatorInset: UIEdgeInsets /


This code shows the two variables, dataSource and delegate, but I'm still wondering how the @IBOutlet notation fits into the table view code?

@IBOutlets not appearing in code?
 
 
Q