Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Vending Machine App in Swift Loading Data From a Resource Inventory Errors

Type FoodVendingMachine does not conform to a protocol VendingMachine

protocol VendingMachine { var selection: [String] {get} var inventory: [VendingSelection: VendingItem] {get set} var amountDeposited: Double {get set}

init (inventory: [VendingSelection: VendingItem])
func vend (_ quantity: Int, _ selection: [VendingSelection]) throws
func deposit(_ amount: Double)

}

class FoodVendingMachine: VendingMachine { let selection: [VendingSelection] = [.soda, .dietSoda, .chips, .fruitJuice, .cookie, .gum, .popTart, .sportsDrink, .water, .wrap, .candyBar, .sandwich] var inventory: [VendingSelection: VendingItem] var amountDeposited: Double = 10.0

required init(inventory: [VendingSelection : VendingItem]) {
    self.inventory = inventory

}
func vend(_ quantity: Int, _ selection: [VendingSelection]) throws {

}
func deposit(_ amount: Double) {

}
Jeff McDivitt
Jeff McDivitt
23,970 Points

Can you please format your code so I can look at it.