My viewcontroller.Swift is as follows:
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let sharedDefaults = NSUserDefaults(suiteName: "group.devoncarlson.sinceextentionsharingefaults")
sharedDefaults?.setObject("Hi I'm a Widget", forKey: "stringKey")
sharedDefaults?.synchronize()
}
var eventInArray = ["Drinking"]
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return the number of rows in the section.
return eventInArray.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->
UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath:
indexPath) as UITableViewCell
// Configure the cell...
cell.textLabel?.text = eventInArray[indexPath.row]
return cell
}
// cell.textLabel.text = eventInArray[indexPath.row]
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
What is causing this? It began after linking my table view to my code. Please explain your answer as if to a five year old, I'm very new to programming.
0 comments:
Post a Comment