From fa154e32e4c566a43b1d002ffafc532834496e41 Mon Sep 17 00:00:00 2001 From: Orvybr0wn1 Date: Fri, 11 Jan 2019 22:15:50 -0500 Subject: [PATCH] Array Challenge --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ ArrayChallenge/ShoppingList.swift | 13 +++++++++---- 2 files changed, 17 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..36bf2bb 100644 --- a/ArrayChallenge/ShoppingList.swift +++ b/ArrayChallenge/ShoppingList.swift @@ -10,13 +10,18 @@ class ShoppingList { - func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] { - - + func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] + { // Implement this function + var shoppingList: [String] = [] + for (count, item) in items.enumerated() { + + shoppingList.append("\(count + 1). \(item)(\(amounts[count]))") + + } - + return shoppingList } }