unrecognized selector sent to instance is a clue that your method name is incorrect. Method names have been called selectors in Objective-C, which is where that name comes from.
You should be able to look at the error message and it should say which selector it is trying to call. Read it carefully, and that will give you a clue something is wrong with what you’re trying to do for that method.
Decoder is all about reading and unarchiving. That step will fail if your plumbing isn’t hooked up, so you just need to double check that you can open a file. This isn’t the writing step (which generated the inventory.plist file).
When I do file input/output (i/o). I’m always building up… first writing, then working on reading. Both operations need to work hand-in-hand. And on more complex projects you should get into writing a unit test that could test if those steps do work… so that you don’t accidentally break something when you go to ship your app.
You will get better with time and exposure to new code. The more you experiment the better. You could try redoing this app from scratch to re-inforce the concepts that you learned. Or something similar using a different set of data.
Compile Time Errors
When I change the “coder” to “code” in the Inventory I get a compile time error, did you not see that?
InvetoryTracker2/inventory.swift:11:7: Type 'Inventory' does not conform to protocol 'NSCoding'
Using Auto Complete to generate these methods will also help, instead of typing them by hand. Type “init” and press ESC to get a list of methods and choose the correct one. Do the same for the encoder, type “encode” and press ESC to choose the correct method.
For most delegate protocols (NSCoding) you can look at the documentation, start typing the first few letters and then use Auto Complete to fill out the proper name.