Reputation: 111
I'm following Ray Wenderlich's tutorial right now (http://www.raywenderlich.com/77974/making-a-gesture-driven-to-do-list-app-like-clear-in-swift-part-1). Whenever I run my app it comes up with the same information that is listed in the code:
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var toDoItems = [ToDoItem]()
override func viewDidLoad() {
super.viewDidLoad()
if toDoItems.count > 0 {
return
}
toDoItems.append(ToDoItem(text: "feed the cat"))
toDoItems.append(ToDoItem(text: "buy eggs"))
toDoItems.append(ToDoItem(text: "watch WWDC videos"))
toDoItems.append(ToDoItem(text: "rule the Web"))
toDoItems.append(ToDoItem(text: "buy a new iPhone"))
toDoItems.append(ToDoItem(text: "darn holes in socks"))
toDoItems.append(ToDoItem(text: "write this tutorial"))
toDoItems.append(ToDoItem(text: "master Swift"))
toDoItems.append(ToDoItem(text: "learn to draw"))
toDoItems.append(ToDoItem(text: "get more exercise"))
toDoItems.append(ToDoItem(text: "catch up with Mom"))
toDoItems.append(ToDoItem(text: "get a hair cut"))
}
Even if I delete the line "get a hair cut" when I restart the app, the "get a hair cut" reappears. If I were to submit the app to the Appstore, would the same thing happen when opening the app on my iPhone? How can I make it so that the app saves when I add and delete to-do list items? Thank you!
Upvotes: 0
Views: 132