<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 class="">The final code to test this is:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Foundation</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">import</span><span style="font-variant-ligatures: no-common-ligatures" class=""> MapKit</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">class</span><span style="font-variant-ligatures: no-common-ligatures" class=""> ManifestItem: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">NSObject</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> title: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">!</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-variant-ligatures: no-common-ligatures" class=""> subtitle: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">?</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">dynamic</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> coordinate: </span><span style="font-variant-ligatures: no-common-ligatures" class="">CLLocationCoordinate2D</span></div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">init</span><span style="font-variant-ligatures: no-common-ligatures" class="">(title: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">, subtitle: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">String</span><span style="font-variant-ligatures: no-common-ligatures" class="">?, coordinate: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CLLocationCoordinate2D</span><span style="font-variant-ligatures: no-common-ligatures" class="">) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">title</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = title</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">subtitle</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = subtitle</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">coordinate</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = coordinate</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">extension</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">ManifestItem</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">MKAnnotation</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><div style="font-family: Helvetica; font-size: 12px;" class="">This displays a warning in beta 3, as well as in Swift 2.2 in the current Xcode.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">I understand why: MKAnnotation declares my title must be optional (“?”) but I am declaring it as an implicitly unwrapped optional (“!”). Still, I believe the fact is that they are both optional, and are a legitimate way of declaring “a protocol I conform to requires this to be optional, but it can be treated as implicitly inwrapped because it will never be nil”.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Thoughts?</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">- Rod</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 24 Jul 2016, at 11:09 PM, Zhao Xin <<a href="mailto:owenzx@gmail.com" class="">owenzx@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">I pasted you code into Xcode 8 beta3 playground, everything seemed fine with below code.</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="color:rgb(187,44,162)" class="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Cocoa</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="color:rgb(187,44,162)" class="">import</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> CoreLocation</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="color:rgb(187,44,162)" class="">class</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> ManifestItem: </span><span style="color:rgb(112,61,170)" class="">NSObject</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> value: </span><span style="color:rgb(112,61,170)" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> title: </span><span style="color:rgb(112,61,170)" class="">String</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> subtitle: </span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">?</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(112, 61, 170);" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">dynamic</span><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="" class=""> coordinate: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">CLLocationCoordinate2D</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">init</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(value:</span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, title:</span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, subtitle:</span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">? = </span><span style="color:rgb(187,44,162)" class="">nil</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, coordinate:</span><span style="color:rgb(112,61,170)" class="">CLLocationCoordinate2D</span><span style="font-variant-ligatures: no-common-ligatures;" class="">) {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="color:rgb(79,129,135)" class="">value</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = value</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="color:rgb(79,129,135)" class="">title</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = title</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="color:rgb(79,129,135)" class="">subtitle</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = subtitle</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">self</span><span style="font-variant-ligatures: no-common-ligatures;" class="">.</span><span style="color:rgb(79,129,135)" class="">coordinate</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = coordinate</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="color:rgb(187,44,162)" class="">@objc</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">public</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">protocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> MKAnnotation : </span><span style="color:rgb(112,61,170)" class="">NSObjectProtocol</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> {</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Center latitude and longitude of the annotation view.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// The implementation of this property must be KVO compliant.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> coordinate: </span><span style="color:rgb(112,61,170)" class="">CLLocationCoordinate2D</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> { </span><span style="color:rgb(187,44,162)" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);" class=""><span style="" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">// Title and subtitle for use by selection UI.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">@objc</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">optional</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> title: </span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">? { </span><span style="color:rgb(187,44,162)" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">@objc</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">optional</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="color:rgb(187,44,162)" class="">var</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> subtitle: </span><span style="color:rgb(112,61,170)" class="">String</span><span style="font-variant-ligatures: no-common-ligatures;" class="">? { </span><span style="color:rgb(187,44,162)" class="">get</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">I didn't encounter the error you mentioned. But I had to remove public and add @objc as Xcode asked.</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Zhaoxin</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Jul 24, 2016 at 12:09 PM, Rod Brown via swift-users <span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Swift Users,<div class=""><br class=""><div class="">I just ran across an issue where I had the following code:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#bb2ca2" class="">class</span><span class=""> ManifestItem: </span><span style="color:#703daa" class="">NSObject</span><span class=""> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">let</span><span class=""> value: </span><span style="color:#703daa" class="">String</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">let</span><span class=""> title: </span><span style="color:#703daa" class="">String</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">let</span><span class=""> subtitle: </span><span style="color:#703daa" class="">String</span><span class="">?</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""><span style="color:rgb(187,44,162)" class=""> dynamic var</span><span class=""> coordinate: </span><span style="color:rgb(112,61,170)" class="">CLLocationCoordinate2D</span></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">As part of utilising this object, I needed it to conform to MKAnnotation, which declares:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">protocol</span><span class=""> MKAnnotation : </span><span style="color:#703daa" class="">NSObjectProtocol</span><span class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span class=""> </span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="" class=""> </span><span class="">// Center latitude and longitude of the annotation view.</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="" class=""> </span><span class="">// The implementation of this property must be KVO compliant.</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">var</span><span class=""> coordinate: </span><span style="color:#703daa" class="">CLLocationCoordinate2D</span><span class=""> { </span><span style="color:#bb2ca2" class="">get</span><span class=""> }</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><span class=""> </span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="" class=""> </span><span class="">// Title and subtitle for use by selection UI.</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">optional</span><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">var</span><span class=""> title: </span><span style="color:#703daa" class="">String</span><span class="">? { </span><span style="color:#bb2ca2" class="">get</span><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#bb2ca2" class="">optional</span><span class=""> </span><span style="color:#bb2ca2" class="">public</span><span class=""> </span><span style="color:#bb2ca2" class="">var</span><span class=""> subtitle: </span><span style="color:#703daa" class="">String</span><span class="">? { </span><span style="color:#bb2ca2" class="">get</span><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">I added the appropriate extension to “ManifestItem” and promptly got reminded with an error that MKAnnotation requires title be an optional.</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">To do this, I converted “title” in my ManifestItem class to be an implicitly unwrapped optional. This value can never be nil, and should be treated as such throughout my code. However, the compiler still emits a warning. "</span>Type of 'title' has different optionality than expected by protocol ‘MKAnnotation' "</div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">I’m wondering if this should be considered a bug? I am actually comforming correctly to the protocol - title is optional, though implicitly unwrapped. Should I have to make “title” optional, and every use of it optional or a force unwrap, when my code verifies that the manifest item is legitimately invalid if title property is nil?</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">I think this is valid use of the implicitly unwrapped optional. It allows you to say “this is optional for some reason, but should generally always be assumed to be non null.” This sounds remarkably similar to my use case "</span>this is optional for conformance reasons, but should generally always be assumed to be non null.”</div><div class=""><br class=""></div><div class="">Thanks for your opinions,</div><div class=""><br class=""></div><div class="">Rod</div></div></div><br class="">_______________________________________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>