From b08e4d0cd59ab3d31a77924c6e4d8652e7abf81f Mon Sep 17 00:00:00 2001 From: shulman44 Date: Mon, 14 May 2018 20:48:19 -0400 Subject: [PATCH] Finish --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ ArrayChallenge/ShoppingList.swift | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ArrayChallenge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ArrayChallenge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ArrayChallenge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ArrayChallenge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ArrayChallenge/ShoppingList.swift b/ArrayChallenge/ShoppingList.swift index 646e1db..9655ae0 100644 --- a/ArrayChallenge/ShoppingList.swift +++ b/ArrayChallenge/ShoppingList.swift @@ -13,7 +13,19 @@ class ShoppingList { func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] { - // Implement this function + var shoppingList: [String] = [] + + for (index, item) in items.enumerated() { + + let amount = amounts[index] + + let shoppingItem = "\(index + 1). \(item)(\(amount))" + + shoppingList.append(shoppingItem) + + } + + return shoppingList