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 Creating an Inventory

Durus Mihai
Durus Mihai
2,660 Points

Vending machine app, class doesn't conform to protocol.

Hi, i have an error in my code, it says that my class "FoodVendingMachine" doesn't conform to my protocols... but it does, and i checked many times the code, thank you for help! https://gyazo.com/8645dbd0d60e0e89fe8469d9b20b340f -first screenshot https://gyazo.com/0e6861b7ee2de79f64437b2c4c2a0472 -seccond screenshot

Martin Wildfeuer
Martin Wildfeuer
Courses Plus Student 11,071 Points

Hey Durus Mihai, could you please paste the code here as well? I'll check this out, but it's easier to copy and paste the code than typing it all again. :)

Xavier Avery
Xavier Avery
8,059 Points

Hey Durus Mihai I think the deposit function should be of type Double not Int. "func deposit(_ amount: Double)" It's of type Double in both screenshots you sent

1 Answer

Xavier Avery
Xavier Avery
8,059 Points

Hey Durus Mihai I think the deposit function should be of type Double not Int. "func deposit(_ amount: Double)" It's of type Double in both screenshots you sent