<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 17, 2017, at 5:47 PM, William Jon Shipley <<a href="mailto:wjs@delicious-monster.com" class="">wjs@delicious-monster.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I <i class="">think</i> the comments on “prettify()” are from an earlier version of the sample code? The way it’s called it doesn’t look like it’d access theList at all.</div></div></blockquote><div><br class=""></div><div>The body of the function is omitted :-)</div><div><br class=""></div><div>The idea of the goofy example is that it walks through theList to see if the existing entries are capitalized. If so, it capitalizes the string, if not it returns the string unmodified.</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(246, 248, 250); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class=""> actor TableModel {
<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">let</span> mainActor <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">:</span> TheMainActor
<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">var</span> theList <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">:</span> [<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">String</span>] <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">=</span> [] {
<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">didSet</span> {
mainActor.<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">updateTableView</span>(theList)
}
}
<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">init</span>(<span class="pl-smi" style="box-sizing: border-box;"><span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">mainActor</span></span>: TheMainActor) { <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">self</span>.<span class="pl-smi" style="box-sizing: border-box;">mainActor</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">=</span> mainActor }
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"><span class="pl-c" style="box-sizing: border-box;">//</span> this checks to see if all the entries in the list are capitalized:</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"></span> <span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"><span class="pl-c" style="box-sizing: border-box;">//</span> if so, it capitalize the string before returning it to encourage</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"></span> <span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"><span class="pl-c" style="box-sizing: border-box;">//</span> capitalization consistency in the list.</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"></span> <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">prettify</span>(<span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">_</span> <span class="pl-smi" style="box-sizing: border-box;">x</span> : <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">String</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">-></span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">String</span> {
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"><span class="pl-c" style="box-sizing: border-box;">//</span> ... details omitted, it just pokes theList directly ...</span>
<span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"></span> }
actor <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">add</span>(<span class="pl-smi" style="box-sizing: border-box;"><span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">entry</span></span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">String</span>) {
theList.<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">append</span>(<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">prettify</span>(entry))
}
}</pre><div class=""><br class=""></div></div></div></div></div></blockquote></div><br class=""></body></html>