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:

> import Foundation
> import AppKit
> 
> let html = "<i>hello world</i>"
> let data = html.data(using: .utf8, allowLossyConversion: true)!
> let attributed = NSAttributedString(HTML: data, documentAttributes: nil)

The error that I get in the REPL (which is essentially identical to the one I 
get in an Xcode project) is:

> error: ambiguous use of 'init(HTML:documentAttributes:)'
> let str = NSAttributedString(HTML: data!, documentAttributes: nil)
>           ^
> 
> found this candidate
> found this candidate

How should I do it? And perhaps more importantly, what's being done to allow me 
to figure it out myself?

Félix

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to