From 1c0601719865bb6e4a18df50d58eec0077fc7893 Mon Sep 17 00:00:00 2001 From: thenewromantic Date: Fri, 6 Apr 2018 11:59:32 +1000 Subject: [PATCH] done --- ArrayChallenge/ShoppingList.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ArrayChallenge/ShoppingList.swift b/ArrayChallenge/ShoppingList.swift index 646e1db..c62560c 100644 --- a/ArrayChallenge/ShoppingList.swift +++ b/ArrayChallenge/ShoppingList.swift @@ -13,10 +13,22 @@ class ShoppingList { func createShoppingList(withItems items: [String], amountOfEachItem amounts: [String]) -> [String] { - // Implement this function + var newArray: [String] = [] + for (index, item) in items.enumerated() { + + let amount = amounts[index] + + let shoppingItem = "\(index + 1). \(item)(\(amount))" + + newArray.append(shoppingItem) + + } + return newArray + } } +