<code>
var
restaurant: Restaurant!
@IBOutlet weak
var
imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
imageView.image = UIImage(named: restaurant.image)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return
1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return
4
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(
"DetailCell"
, forIndexPath: indexPath)
as
! DetailTableViewCell
switch
indexPath.row{
case
0:
cell.fieldLabel.text =
"Restaurant Name"
cell.valueLabel.text = restaurant.name
case
1:
cell.fieldLabel.text =
"Restaurant Type"
cell.valueLabel.text = restaurant.type
case
2:
cell.fieldLabel.text =
"Restaurant Location"
cell.fieldLabel.text = restaurant.location
case
3:
cell.fieldLabel.text =
"Visted?"
cell.fieldLabel.text = restaurant.isVisted ?
"Yes"
:
"No"
default
:
cell.fieldLabel.text =
""
cell.valueLabel.text =
""
}
return
cell
}
</code>