Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions TvOSTextViewer/Sources/TvOSTextViewerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// TvOSTextViewer
//
// Created by David Cordero on 15.02.17.
// Edited by Paoloandrea on 10.03.2022
// Copyright © 2017 David Cordero. All rights reserved.
//

Expand All @@ -22,6 +23,8 @@ public class TvOSTextViewerViewController: UIViewController {
@objc public var textAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: defaultTextColor,
.font: defaultFont]

@objc public var attributes:NSAttributedString?

private var backgroundView: UIVisualEffectView!
private var textView: FadedTextView!

Expand Down Expand Up @@ -62,9 +65,13 @@ public class TvOSTextViewerViewController: UIViewController {
textView.panGestureRecognizer.allowedTouchTypes = [NSNumber(integerLiteral: UITouch.TouchType.indirect.rawValue)]
textView.isUserInteractionEnabled = true

textView.attributedText = NSAttributedString(string: text,
if attributes != nil {
textView.attributedText = attributes
} else {
textView.attributedText = NSAttributedString(string: text,
attributes: textAttributes)
view.addSubview(textView)
}
view.addSubview(textView)
}

private func moveTextViewToTheCenter() {
Expand Down