diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-24 17:49:49 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-07-24 17:49:49 +0530 |
commit | cc570f32d517d507db279c3d530efd8bfd7f62bf (patch) | |
tree | 94cdc7930d163bada67477094dc8a1ff4cbe5dc6 | |
parent | e080c46fa53d9beac0ef4273c96daa7a315c6fad (diff) |
The DetailedView now shows the question rather than a static string and the description's HTML tags are all removed
-rw-r--r-- | Qrious/DetailedView.swift | 23 |
1 files 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) |