From cc570f32d517d507db279c3d530efd8bfd7f62bf Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 24 Jul 2020 17:49:49 +0530 Subject: The DetailedView now shows the question rather than a static string and the description's HTML tags are all removed --- Qrious/DetailedView.swift | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Qrious/DetailedView.swift b/Qrious/DetailedView.swift index d8fd751..233c6cc 100644 --- a/Qrious/DetailedView.swift +++ b/Qrious/DetailedView.swift @@ -10,25 +10,6 @@ import SwiftUI -extension String { - public var withoutHtml: String { - guard let data = self.data(using: .utf8) else { - return self - } - - let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [ - .documentType: NSAttributedString.DocumentType.html, - .characterEncoding: String.Encoding.utf8.rawValue - ] - - guard let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) else { - return self - } - - return attributedString.string - } -} - struct DetailedView: View { //public var description: String //@State public var defined_type_name: String = "p" @@ -84,7 +65,7 @@ struct DetailedView: View { Button("Paper URL") { UIApplication.shared.open(URL(string: self.paperURL)!) } - Text("Possible Candidates") + Text(self.config.question) .font(.headline) .fontWeight(.semibold) .multilineTextAlignment(.leading) @@ -94,7 +75,7 @@ struct DetailedView: View { .fontWeight(.semibold) ScrollView(.vertical){ VStack{ - Text(description1) + Text((description1.replacingOccurrences(of: "<[^>]+>", with: "", options: String.CompareOptions.regularExpression, range: nil)).replacingOccurrences(of: "&[^;]+;", with: "", options: String.CompareOptions.regularExpression, range: nil)) //Text(description1.withoutHtml) } .frame(maxWidth: .infinity) -- cgit v1.2.3