<div dir="ltr">You are implementing function defined in the WCSessionDelegate so that your AppDelegate can be called by WCSession as things happen. It calls your implementation and supplies it with an error is one exists (e.g. an error happened).<div><br></div><div>It doesn&#39;t make sense for this function (the one you implement) to throw since you aren&#39;t returning an error to the caller (WCSession) but instead potentially getting an error from the caller (WCSession).</div><div><br></div><div><div>-Shawn</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 7, 2016 at 8:53 PM Zhao Xin &lt;<a href="mailto:owenzx@gmail.com">owenzx@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="display:inline">I also have a question on this API </div><div class="gmail_default" style="font-family:georgia,serif;display:inline">​`func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?)`. Why did it use `throws`? The other APIs, which use NSError in Objective-C, change to throws in Swift counterpart.</div><div><div class="gmail_default" style="font-family:georgia,serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:georgia,serif;display:inline">Zhaoxin</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 10:52 AM, Shawn Erickson <span dir="ltr">&lt;<a href="mailto:shawnce@gmail.com" target="_blank">shawnce@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">For one RealmSwift should likely consider changing their enum cases to use lowerCamelCase like Swift 3 did. Also at some point it should consider the changes to NSError / Swift.Error bridging.<div><br></div><div>-Shawn</div></div><br><div class="gmail_quote"><div><div><div dir="ltr">On Wed, Sep 7, 2016 at 7:18 PM Zhao Xin via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">When I use RealmSwift in my project, I got an alert &quot; &#39;Error&#39; is ambiguous for type lookup in this context&quot;.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default"><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">import</span><span> UIKit</span></p>
<p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">import</span><span> UserNotifications</span></p>
<p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">import</span><span> WatchConnectivity</span></p>
<p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span style="color:rgb(187,44,162)">import</span><span> RealmSwift</span></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span><br></span></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal;color:rgb(112,61,170)"><span style="color:rgb(187,44,162)">extension</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(79,129,135)">AppDelegate</span><span style="color:rgb(0,0,0)">:</span><span>WCSessionDelegate</span><span style="color:rgb(0,0,0)"> {</span></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span>    </span><span style="color:rgb(187,44,162)">func</span><span> session(</span><span style="color:rgb(187,44,162)">_</span><span> session: </span><span style="color:rgb(112,61,170)">WCSession</span><span>, activationDidCompleteWith activationState: </span><span style="color:rgb(112,61,170)">WCSessionActivationState</span><span>, error: </span><span style="color:rgb(112,61,170)">Error</span><span>?) { </span></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><br></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span>





</span></p><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span>    }</span></p><div style="font-family:georgia,serif"><span style="font-family:menlo;font-size:11px"> }</span><br></div><p style="font-family:menlo;margin:0px;font-size:11px;line-height:normal"><span><br></span></p><p style="margin:0px;line-height:normal"><font color="#000000" face="georgia, serif"><span>I think the reason is that in Swift, Error is a protocol. And in RealmSwift, there is a `</span>case Error(NSError)` in `public enum RealmCollectionChange&lt;T&gt;`.</font></p><p style="margin:0px;line-height:normal"><font face="georgia, serif" color="#000000"><span><br></span></font></p><p style="margin:0px;line-height:normal"><font face="georgia, serif" color="#000000"><span>I managed to eliminate the alert buy change `<span>Error</span><span>?</span>` to `</span><span>Swift</span><span>.</span><span>Error</span><span>?`. Are there any other ways to fix this?</span></font></p><p style="margin:0px;line-height:normal"><font face="georgia, serif" color="#000000"><span><br></span></font></p><p style="margin:0px;line-height:normal"><font face="georgia, serif" color="#000000"><span>Zhaoxin</span></font></p></div></div></div></div>
_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
</blockquote></div>
</blockquote></div><br></div>
</blockquote></div>