From b9c50f5b1a22e8bfd93fc550f5715a8515bd83eb Mon Sep 17 00:00:00 2001 From: Luis Puentes Date: Tue, 8 Jan 2019 17:44:52 -0700 Subject: [PATCH 1/2] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 47a9655..505261b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ struct Item { ``` class ItemsController { - var items: [String] = [] + var items: [Item] = [] } ``` @@ -57,7 +57,7 @@ class ItemsController { - Add a method to add a new item to your list. You must complete this method so it adds a new item. ``` -func add(_ item: String) { +func add(_ item: Item) { // add the item to your items list } ``` @@ -104,7 +104,7 @@ Follow these steps to hook up your interface to your ViewController implementati - Implement shouldReset by calling your model's `resetItems()` method and then set the label text to `""`. - In `shouldAdd`, use nil-coalescing to retrieve text from the text field: `let text = textField.text ?? ""`. - If the text is not empty (`!text.isEmpty`), add it to your model. Then set the textField text to `""`. (Why do you do this? Try to think it through and test it both ways.) -- Use a `joined` method to convert your model's list to a string: `let joined = Model.shared.items.joined(separator: "\n")` +- Use a `joined` method to convert your model's list to a string: `let joined = itemController.items.joined(separator: "\n")` ## Minimum Viable Product From 3bbad6ec5948fe083b5cd344c4f8c2c6ecd4e6e8 Mon Sep 17 00:00:00 2001 From: Luis Puentes Date: Wed, 9 Jan 2019 08:45:55 -0700 Subject: [PATCH 2/2] Updated the Add function by changing the parameter to name and type String This is done so they can pass in the name of the item. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 505261b..56dde5e 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ class ItemsController { - Add a method to add a new item to your list. You must complete this method so it adds a new item. ``` -func add(_ item: Item) { +func add(_ name: String) { // add the item to your items list } ```