Иногда эта штука падает, но я не знаю, почему и когда.
У кого-нибудь есть идея?
extension String {
var htmlDecoded: String? {
if let encodedData = self.data(using: String.Encoding.utf8) as Data? {
let attributedOptions = [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: String.Encoding.utf8.rawValue] as [String : Any]
do {
let attributedString = try NSAttributedString(data: encodedData,
options: attributedOptions,
documentAttributes: nil)
return attributedString.string
} catch let error as NSError {
print("ERROR: ", error.localizedDescription)
return self
}
}
return self
}
}
Это ошибка, которую я получаю от HockeyApp
function signature specialization <Arg[0] = Owned To Guaranteed and Exploded> of @nonobjc (extension in UIKit):__C.NSAttributedString.init(data: Foundation.Data, options: [Swift.String : Any], documentAttributes: Swift.AutoreleasingUnsafeMutablePointer<__C.NSDictionary?>?) throws -> __C.NSAttributedString (String+html.swift:0)
function signature specialization <Arg[0] = Exploded> of (extension in Podcat_2):Swift.String.htmlDecoded.getter : Swift.String? (String+html.swift:0)