Christopher Hardwick has been in the workforce since 2002, when they began their role as Purchasing Agent at Crest Pontoons - Crest Marine LLC. In 2015, they took on a new role as Customer Service Representative at Covenant Eyes.
//
// ViewController.swift
// Todoey
//
// Created by Abhiram Abbineni on 7/2/18.
// Copyright © 2018 Abhiram Abbineni. All rights reserved.
//
import UIKit
class TodoListViewController: UITableViewController {
var itemArray = Item
let dataFilePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("Items.plist")
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
print(dataFilePath)
loadItems()
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return itemArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ToDoItemCell", for: indexPath)
let item = itemArray[indexPath.row]
cell.textLabel?.text = item.title
cell.accessoryType = item.done ? .checkmark : .none
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
itemArray[indexPath.row].done = !itemArray[indexPath.row].done
saveItems()
tableView.deselectRow(at: indexPath, animated: true)
}
@IBAction func addButtonPressed(_ sender: UIBarButtonItem) {
var textField = UITextField()
let alert = UIAlertController(title: "Add New Todoey Item", message: "", preferredStyle: .alert)
let action = UIAlertAction(title: "Add Item", style: .default) { (action
Sign up to view 0 direct reports
Get started