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 2.0 Loading Data From a Resource Finishing Touches

Compiler Error

On the line:
self.vendingMachine = VendingMachine(inventory: inventory)

It gives me a compiler error saying:

cannot call value of non-function type 'module<VendingMachine>'

I looked at my code and in video he said it is a class... I don't see that class any where in my code did he add this in video somewhere or does he have it and we don't?

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Trent,

The code snippet you provided looks correct. It's really hard to troubleshoot off just that, however.

You could post all your code from your ViewController.swift file, but what I recommend (and I have done myself on more than one occasion), is to download the completed Project Files and compare and troubleshoot your code to its code.

Hope you find the bug. :) :dizzy:

ok thx!