I need to implement message View like WhatsApp - message time and ticks should be approximately on the same line with the last line of text if the text does not reach the end, and if it reaches the end, then the time is transferred to the next line.
How can this be done? Maybe there are examples or tutorials?
now i get it like this:
code:
HStack(alignment: .lastTextBaseline) {
VStack(alignment: .leading, spacing: 8) {
if isFirstMessage, !isCurrentUser {
Text(name)
.font(.headline)
.foregroundColor(Colors.message.color)
}
HStack(alignment: .bottom) {
Text(text)
.foregroundColor(Colors.message.color)
timeCheckMarkOverlay
}
}
}
.padding([.leading, .trailing], 12)
.padding([.top, .bottom], 7)
.cornerRadius(10)
.background(isCurrentUser ? Colors.currentUserMessage.color : Colors.anotherUserMessage.color)