Note that there are some explanatory texts on larger screens.

plurals
  1. POSimpleStocks protocol usage (Apple sample code)
    primarykey
    data
    text
    <p>In the <a href="https://developer.apple.com/legacy/library/samplecode/SimpleStocks/Introduction/Intro.html" rel="nofollow">SimpleStocks</a> sample code provided by Apple, dataSource is defined as follows:</p> <pre><code>property (nonatomic, weak) IBOutlet id &lt;APLSimpleStockViewDataSource&gt; dataSource; </code></pre> <p>and then used variously as follows (only 2 examples, but there are more in the code)</p> <pre><code>NSInteger dataCount = [self.dataSource graphViewDailyTradeInfoCount:self]; NSArray *sortedMonths = [self.dataSource graphViewSortedMonths:self]; </code></pre> <p>I understand what graphViewDailyTradeInfoCount does, and also graphViewSortedMonths.I would have understood: <code>NSInteger dataCount = [APLStockViewController graphViewDailyTradeInfoCount:self];</code> (Tried that, and I think I know why that can't work)</p> <p>Here's the rub: The way I read the 1st line of code, dataSource is being sent the message graphViewDailyTradeInfoCount (which returns some numeric value specifying how many transactions occurred). If we assume 25 transactions, essentially [dataSource 25]; And now my mind is boggling, because I am strongly expecting that somewhere, there would be code telling dataSource what to do with the 25 it is being sent. But there isn't!!!</p> <p>Then the boggling increases by an order of magnitude: dataSource having been sent the 25, it now returns that and puts it into dataCount. How does it know to do that, there's no code anywhere that I can find for that either.</p> <p>And now, tickle me ballistic, in the second line of code, dataSource knows to accept (and then return) an NSArray.</p> <p>In my ever rarer sane moments, it looks to me like dataSource really doesn't do anything other than "pass through" stuff that it gets handed. Computers can't do magic, it feels like a feature, but where is it documented ?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload