<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Hi Tony,</div><div><br></div><div>Thank you so much I have a filed a bug for it under Foundation. </div><div><br></div><div>Thanks and regards,</div><div>Muthu</div><div><br></div><div><br>On 15 Jun 2017, at 8:27 AM, Tony Parker <<a href="mailto:anthony.parker@apple.com">anthony.parker@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Hi Somu,<div class=""><br class=""></div><div class="">You can certainly file a bug for us. It may be something we are already tracking or already fixed, but the bug report will let us double check that.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">- Tony<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 13, 2017, at 12:33 PM, somu subscribe via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</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; -webkit-line-break: after-white-space;" class=""><div class="">Thanks a lot Jordan for pointing out the root cause.</div><div class=""><br class=""></div><div class="">The underlying <font face="Menlo" color="#0433ff" class="">executing</font> and <font face="Menlo" color="#0433ff" class="">finished</font> properties are <font color="#0433ff" face="Menlo" class="">readonly</font> properties.</div><div class=""><br class=""></div><div class="">For an Asynchronous operation I had to <font face="Menlo" color="#0433ff" class="">override</font> it tell when the asynchronous operation completes. </div><div class=""><br class=""></div><div class="">Since they are readonly properties I am unable to call the <font face="Menlo" color="#0433ff" class="">super</font> on them to set values.</div><div class=""><br class=""></div><div class="">I can still use <font face="Menlo" color="#0433ff" class="">String</font>, was just wondering if there was a way to do it using <font color="#0433ff" face="Menlo" class="">KeyPath</font>. It is more out of enthusiasm to try out the <font color="#0433ff" face="Menlo" class="">KeyPath</font> feature in the project :) </div><div class=""><br class=""></div><div class="">Would it be appropriate to file a bug report for the implementation of <font face="Menlo" color="#0433ff" class="">Operation</font> ?</div><div class=""><br class=""></div><div class="">Thanks and regards,</div><div class="">Muthu</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 14 Jun 2017, at 1:32 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.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=""><div class="">Hi, Muthu. This is a longstanding issue with Operation—the Objective-C name of the property is just "executing", but the KVO keys that the implementors used is "isExecuting". Swift isn't set up to deal with this difference.</div><div class=""><br class=""></div><div class="">Fortunately, the base implementation of Operation already knows how to send the KVO notifications, so you shouldn't have to override these properties at all. If you still want to for some other reason, you can call super instead of storing to a private property.</div><div class=""><br class=""></div><div class="">Hope that helps,</div><div class="">Jordan</div><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jun 13, 2017, at 06:40, somu subscribe via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I am having trouble using <font face="Menlo" color="#0433ff" class="">KeyPath</font> to <font color="#0433ff" face="Menlo" class="">KVC</font> (Key Value Code) in <font color="#0433ff" face="Menlo" class="">Swift 4</font>.</div><div class=""><br class=""></div><div class="">I have a subclass of <font color="#0433ff" face="Menlo" class="">Operation</font> and I am overriding the <font color="#0433ff" face="Menlo" class="">isFinished</font> and <font color="#0433ff" face="Menlo" class="">isExecuting</font> property.</div><div class=""><br class=""></div><div class=""><b class="">Problem:</b></div><div class="">- When I use <span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">KeyPath</span>, the <span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">completionBlock</span> of the operation is not invoked.</div><div class="">- However when I use <font face="Menlo" color="#0433ff" class="">String</font> instead of <span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">KeyPath</span>, the <font color="#0433ff" face="Menlo" class="">completionBlock</font> is invoked.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><b class="">Questions:</b></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">- Am I missing something ? </div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class="">- Is there a way to fix it using KeyPath ?</div></div><div class=""><br class=""></div><div class=""><b class="">Code:</b></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">override</span> <span style="color: #ba2da2" class="">var</span> isExecuting : <span style="color: #703daa" class="">Bool</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">get</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="" class=""> </span><span style="color: #ba2da2" class="">return</span><span style="" class=""> </span><span style="color: #4f8187" class="">_executing</span><span style="" class=""> </span>//property in the class</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">set</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3e1e81" class="">willChangeValue</span>(for: \.isExecuting)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #4f8187" class="">_executing</span> = newValue</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3e1e81" class="">didChangeValue</span>(for: \.isExecuting)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">override</span> <span style="color: #ba2da2" class="">var</span> isFinished : <span style="color: #703daa" class="">Bool</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">get</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="" class=""> </span><span style="color: #ba2da2" class="">return</span><span style="" class=""> </span><span style="color: #4f8187" class="">_finished</span><span style="" class=""> </span>//property in the class</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""> <br class="webkit-block-placeholder"></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #ba2da2" class="">set</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3e1e81" class="">willChangeValue</span>(for: \.isFinished)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #4f8187" class="">_finished</span> = newValue</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3e1e81" class="">didChangeValue</span>(for: \.isFinished)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);" class=""><div style="font-size: 12px;" class=""><b class="">Configuration:</b></div><div style="font-size: 12px;" class="">- Xcode - 9.0 beta (9M136h) </div><div style="font-size: 12px;" class="">- Tested on Simulator (iOS 11)</div><div style="font-size: 12px;" class="">- macOS Sierra - 10.12.5 (16F73)</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Thanks and Regards,</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Muthu</span></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></body></html>