<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="">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 = "&lt;i&gt;hello world&lt;/i&gt;"</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 style="margin: 0px; line-height: normal; font-family: Consolas;" class=""></div><blockquote type="cite" class=""><div style="margin: 0px; line-height: normal; font-family: Consolas;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">error: ambiguous use of 'init(HTML:documentAttributes:)'</span></div><div style="margin: 0px; line-height: normal; font-family: Consolas;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">let str = NSAttributedString(HTML: data!, documentAttributes: nil)</span></div><div style="margin: 0px; line-height: normal; font-family: Consolas;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^</span></div><div style="margin: 0px; line-height: normal; font-family: Consolas; min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Consolas;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">found this candidate</span></div><div style="margin: 0px; line-height: normal; font-family: Consolas;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">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 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></div></body></html>