Skip to content

Commit c3a9fe7

Browse files
committed
add .uppercase in user-label
1 parent 36788d6 commit c3a9fe7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

firebaseai/ChatExample/Views/MessageView.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,20 @@ struct MessageView: View {
8484
var message: ChatMessage
8585

8686
private var participantLabel: String {
87-
message.participant == .user ? "USER" : "MODEL"
88-
}
89-
90-
private var alignment: HorizontalAlignment {
91-
message.participant == .user ? .trailing : .leading
87+
message.participant == .user ? "User" : "Model"
9288
}
9389

9490
var body: some View {
95-
VStack(alignment: alignment, spacing: 4) {
91+
VStack(alignment: message.participant == .user ? .trailing : .leading, spacing: 4) {
9692
// Sender label
9793
Text(participantLabel)
9894
.font(.caption2)
9995
.fontWeight(.medium)
10096
.foregroundColor(.secondary)
97+
.textCase(.uppercase)
10198
.padding(.horizontal, 8)
10299
.padding(.vertical, 2)
103-
.frame(maxWidth: .infinity, alignment: alignment)
100+
.frame(maxWidth: .infinity, alignment: message.participant == .user ? .trailing : .leading)
104101

105102
// Message content
106103
HStack {

0 commit comments

Comments
 (0)