sodalive-ios/SodaLive/Sources/Live/Room/V2/Component/Text/TextView.swift

32 lines
801 B
Swift

//
// TextView.swift
// SodaLive
//
// Created by klaus on 2024/01/18.
//
import SwiftUI
import UIKit
struct DetectableTextView: UIViewRepresentable {
var text: String
func makeUIView(context: Context) -> UITextView {
let textView = UITextView()
textView.isEditable = false // Make it readonly
textView.backgroundColor = .clear
textView.isScrollEnabled = true
textView.dataDetectorTypes = .link
textView.font = UIFont(name: Font.light.rawValue, size: 11.3)
textView.textColor = .white
textView.textContainer.lineFragmentPadding = 0
textView.textContainerInset = .zero
return textView
}
func updateUIView(_ uiView: UITextView, context: Context) {
uiView.text = text
}
}