<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="">How did you identify the methods? The source location shows as <unknown>:0 here.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 15 sept. 2016 à 09:05:06, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class="">On Sep 14, 2016, at 9:43 AM, Félix Cloutier 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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I'm trying to create a NSAttributedString from its HTML representation in Swift 3 (from the Xcode 8 GM build). However, this doesn't work:<div class=""><br class=""></div><div class=""></div><blockquote type="cite" class=""><div class="">import Foundation</div><div class="">import AppKit</div><div class=""><br class=""></div><div class="">let html = "<i>hello world</i>"</div><div class="">let data = html.data(using: .utf8, allowLossyConversion: true)!</div><div class="">let attributed = NSAttributedString(HTML: data, documentAttributes: nil)</div></blockquote><div class=""><br class=""></div><div class="">The error that I get in the REPL (which is essentially identical to the one I get in an Xcode project) is:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"></div><blockquote type="cite" class=""><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"><span class="" style="font-variant-ligatures: no-common-ligatures;">error: ambiguous use of 'init(HTML:documentAttributes:)'</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"><span class="" style="font-variant-ligatures: no-common-ligatures;">let str = NSAttributedString(HTML: data!, documentAttributes: nil)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> ^</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Consolas; min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"><span class="" style="font-variant-ligatures: no-common-ligatures;">found this candidate</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Consolas;"><span class="" style="font-variant-ligatures: no-common-ligatures;">found this candidate</span></div></blockquote><div class=""><div class=""><br class="webkit-block-placeholder"></div><div class="">How should I do it? And perhaps more importantly, what's being done to allow me to figure it out myself?</div></div></div></div></div></blockquote><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I go to a more complex call until the issue goes away. Then file a bug. For me, adding options in fixed the issue. </div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>attributed =<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSAttributedString</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(html:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">data</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, options: [:], documentAttributes:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">nil</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Swift seems to struggle with these because without "options", the API could match either one.</div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo; min-height: 19px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> <span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">public</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">init</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?(html data:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Data</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, documentAttributes dict:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">AutoreleasingUnsafeMutablePointer</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSDictionary</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?>?)</span></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo; min-height: 19px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"> </span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">public</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">init</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?(html data:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">Data</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, options: [</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">AnyHashable</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space"> </span>:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(187, 44, 162);">Any</span><span class="" style="font-variant-ligatures: no-common-ligatures;">] = [:], documentAttributes dict:<span class="Apple-converted-space"> </span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">AutoreleasingUnsafeMutablePointer</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">NSDictionary</span><span class="" style="font-variant-ligatures: no-common-ligatures;">?>?)</span></div></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">-- E</div></div></blockquote></div><br class=""></body></html>