In Challenge 2, it asks you sort the holdings by “current value in dollars.” I understand how I would ordinarily go about creating a sort descriptor, but there is currently no property (at least if I’m understanding this terminology correctly, in that it has to be one of the @property values or an instance variable set up manually) for this. I tried using “valueInDollars” as the key for the NSSortDescriptor, and the code built/ran, but nothing ended up getting sorted.
Are we supposed to add a new property to the BNRStockHolding class, or is there some way to make this work without doing so? Also, if I’m totally off-base in my interpretation of the word “property” here–which I’ll fully admit could well be the case–let me know.
EDIT: I appear to have been off-base! I messed up with some of the internals of my topThreeHoldings method, causing the sort to not change anything at all. But just to confirm, then, because the book doesn’t really make it clear, methods (presumably ones that return values) are valid “properties” when it comes to keys in NSSortDescriptors?