<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=""><div style="margin: 0px; line-height: normal;" class=""><span style="text-decoration: underline ; font-kerning: none" class=""><b class="">PROPOSAL:</b></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">I propose the addition of the following new property observers applicable to all Collection types (Dictionary, Set, and Array):</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">– <b class="">willAdd(newValue) { … }</b></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">– <b class="">didAdd(newValue) { … }</b></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">– <b class="">willRemove(oldValue) { … }</b></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">– <b class="">didRemove(oldValue) { … }</b></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">where, `</span><span style="text-decoration: underline ; font-kerning: none" class="">newValue</span><span style="font-kerning: none" class="">` and `</span><span style="text-decoration: underline ; font-kerning: none" class="">oldValue</span><span style="font-kerning: none" class="">` are <b class="">immutable</b>.</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">This would allow one to perform additional work or observer logic to values added and removed from collections. This model is consistent with Swift syntax and may perhaps minimize the use of NSNotifications in some situations.</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">Currently, in order to perform this functionality some filtering and comparison logic would have to be performed from within a `willSet { … }` and `didSet { …}` call. This change would not only ease that burden but promote a more visible and explicit expression that can further improve readability and traceability of functionality.</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="text-decoration: underline ; font-kerning: none" class=""><b class="">EXAMPLE USAGE:</b></span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">var list = [objects]() {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>willAdd(newValue) {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>… </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>didAdd(newValue) {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>…</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">}</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">var list = [key : object]() {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>willRemove(oldValue) {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>…</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>didRemove(oldValue) {</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>…</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">}</span></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; min-height: 14px;" class=""><span style="font-kerning: none" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">-----</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-kerning: none" class="">Sean Alling</span></div><div style="margin: 0px; line-height: normal; color: rgb(0, 105, 217);" class=""><span style="text-decoration: underline ; font-kerning: none" class=""><a href="mailto:allings@icloud.com" class="">allings@icloud.com</a></span></div></body></html>