/
FoodSelectionViewController.swift
45 lines (31 loc) · 1.32 KB
/
FoodSelectionViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// FoodSelectionViewController.swift
// WCApplicationContextDemo
//
// Created by Natasha Murashev on 9/20/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import UIKit
class FoodSelectionViewController: UITableViewController {
private let food = ["🍦", "🍮", "🍤","🍉", "🍨", "🍏", "🍌", "🍰", "🍚", "🍓", "🍪", "🍕", "🍷"]
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return food.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("LabelTableViewCell", forIndexPath: indexPath) as! LabelTableViewCell
cell.configure(withText: food[indexPath.row])
return cell
}
// MARK: Table view delegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let foodItem = food[indexPath.row]
WatchSessionManager.sharedManager.transferUserInfo(["foodItem" : foodItem])
}
}