Is there any way to Highlight the Text And clickable if Text contain URL in the chat screen from both
Sender USer Code:-
import SwiftUI
struct TextHighlightURL: View {
var body: some View {
HStack(alignment: .bottom){
Spacer()
Text("2:22 PM").font(.system(size: 10))
.foregroundColor(.gray)
HStack {
Text("www.google.com")
.foregroundColor(.white)
.multilineTextAlignment(.trailing)
.padding(10)
}
.background(Color.init("DTR-ChatSendrColor"))
.cornerRadius(10.0)
}.padding(.vertical,5)
.padding()
}
}
Output:-
Reciver User Code:-
struct SenderReciverUI1: View {
var body: some View {
Group {
HStack(alignment: .bottom){
VStack(alignment: .leading,spacing:5) {
HStack(alignment: .bottom) {
Text("www.google.com")
.foregroundColor(.white)
.padding(10)
.cornerRadius(10.0)
}
}
Spacer()
}.padding(.vertical,5)
.padding()
}
}
}
My Goal:-
Can someone please explain to me how to show Highlight the Text from both side if sender send the link and receiver receive the link it automatically highlighted And clickable if Text contain URL, I've tried to implement by above but no results yet.
Any help would be greatly appreciated.
Thanks in advance.