aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-04-01 23:29:15 +0530
committerRoopesh Chander <roop@roopc.net>2019-04-01 23:29:15 +0530
commit0299c3929eb61926a0d963f6ea5c54a1d6cc85fc (patch)
tree9efdffa9e8102508b299ec80c856b56aa7e1f970 /WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
parentmacOS: Log view: Fix autoscroll to end of log (diff)
downloadwireguard-apple-0299c3929eb61926a0d963f6ea5c54a1d6cc85fc.tar.xz
wireguard-apple-0299c3929eb61926a0d963f6ea5c54a1d6cc85fc.zip
iOS: Log view: Make log text selectable
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift6
1 files changed, 4 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
index bcfbaf5..0c881f3 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
@@ -8,7 +8,7 @@ class LogViewController: UIViewController {
let textView: UITextView = {
let textView = UITextView()
textView.isEditable = false
- textView.isSelectable = false
+ textView.isSelectable = true
textView.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
textView.adjustsFontForContentSizeCategory = true
return textView
@@ -69,7 +69,9 @@ class LogViewController: UIViewController {
guard !fetchedLogEntries.isEmpty else { return }
let isScrolledToEnd = self.textView.contentSize.height - self.textView.bounds.height - self.textView.contentOffset.y < 1
let text = fetchedLogEntries.reduce("") { $0 + $1.text() + "\n" }
- self.textView.insertText(text)
+ let font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
+ let richText = NSAttributedString(string: text, attributes: [.font: font])
+ self.textView.textStorage.append(richText)
if isScrolledToEnd {
let endOfCurrentText = NSRange(location: (self.textView.text as NSString).length, length: 0)
self.textView.scrollRangeToVisible(endOfCurrentText)