From f949040a451dffba1501f7163e074dac2c434d71 Mon Sep 17 00:00:00 2001 From: chadarutherford Date: Fri, 9 Nov 2018 14:15:10 -0500 Subject: [PATCH] Completed Lab --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ ArrayChallenge/ShoppingList.swift | 11 +++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) 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..444d30e 100644 --- a/ArrayChallenge/ShoppingList.swift +++ b/ArrayChallenge/ShoppingList.swift @@ -11,12 +11,15 @@ class ShoppingList { func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] { + var shoppingList = [String]() - - // Implement this function - - + for (index, item) in items.enumerated() { + let amount = amounts[index] + + shoppingList.append("\(index + 1). \(item)(\(amount))") + } + return shoppingList } }