<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><blockquote type="cite" class=""><div class="">On Jul 22, 2017, at 12:12 AM, William Shipley via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;submodelObservation = observe(<span class="" style="text-decoration: underline;">\</span>.controller.submodel) { object, change<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(186, 45, 162);">in</span></div></div><blockquote class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class="" style="margin: 0px; line-height: normal; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="">&nbsp; &nbsp;&nbsp;</span>// code</div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);">&nbsp; &nbsp;&nbsp;<span class="" style="color: rgb(186, 45, 162);">@objc</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(186, 45, 162);">dynamic</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(186, 45, 162);">internal</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(186, 45, 162);">var</span><span class="Apple-converted-space">&nbsp;</span>controller:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(79, 129, 135);">Controller</span>?</div></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">in the the â€œController" class:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; line-height: normal; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);"><span class="" style=""><br class=""></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);"><span class="" style="">&nbsp; &nbsp;&nbsp;</span>@objc<span class="" style=""><span class="Apple-converted-space">&nbsp;</span></span>dynamic<span class="" style=""><span class="Apple-converted-space">&nbsp;</span></span>internal<span class="" style=""><span class="Apple-converted-space">&nbsp;</span></span>var<span class="" style=""><span class="Apple-converted-space">&nbsp;</span>submodel:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(79, 129, 135);">SubmodelForImporting</span><span class="" style="">?</span></div></div></div></blockquote></div><div class=""><br class=""></div><div class="">I believe you're meant to actually construct a key path which looks through an `Optional` like this:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>\.controller?.submodel</div><div class=""><br class=""></div><div class="">But if you try that, you'll get a different, temporary error:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>error:&nbsp;key path support for optional chaining components is not implemented</div><div class=""><br class=""></div><div class="">My understanding is that optional chaining in key paths *is* planned for Swift 4; it just hasn't landed yet. If making `controller` an implicitly-unwrapped optional would be a suitable workaround for you, I see that a couple pull requests to support IUOs were merged to swift-4.0-branch recently[1]; they might be in the open-source Swift 4 snapshot[2]. If not, my best suggestion would be to temporarily add a computed `controller_submodel` property and use the traditional `keyPathsForValuesAffecting…` mechanism to tie it to the underlying properties.</div><div class=""><br class=""></div><span class="Apple-tab-span" style="white-space:pre">        </span>[1]&nbsp;<a href="https://github.com/apple/swift/pull/11005" class="">https://github.com/apple/swift/pull/11005</a><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>[2]&nbsp;<a href="https://swift.org/download/#snapshots" class="">https://swift.org/download/#snapshots</a><br class=""><div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></div></div></body></html>