[Solved] How do you find something in a dictionary without knowing the name of the dictionary
// A good, more object oriented way- struct Fruit{ var name: String var cost: Double var nutrition: Int } let fruitsDataHolder = [ Fruit(name: “Apple”, cost: 10.0, nutrition: 5), Fruit(name: “Banana”, cost: 15.0, nutrition: 10) ] func getFruitsCost(fruits: [Fruit]) -> Double{ var totalCost = 0.0 for fruit in fruits{ totalCost += fruit.cost } return totalCost … Read more