We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
struct ChatView: View { let messages = [ ChatMessage(message: "Hello!", isMine: false), ChatMessage(message: "Hi there!", isMine: true), ChatMessage(message: "How are you?", isMine: false), ChatMessage(message: "I'm doing well, thank you.", isMine: true), ChatMessage(message: "That's great to hear!", isMine: false) ]
let myName = "Me" let helperName = "Helper" let myAvatar = "avatar1" let helperAvatar = "avatar2" var body: some View { List(messages) { message in HStack { if message.isMine { Spacer() VStack(alignment: .trailing) { HStack { Text(myName) Image(myAvatar) .resizable() .frame(width: 40, height: 40) .background(.blue) .cornerRadius(20) } Spacer() Text(message.message) .padding() .background(Color.purple) .foregroundColor(.black) .cornerRadius(10) .padding(.horizontal, 50) } } else { VStack(alignment: .leading) { HStack { Image(helperAvatar) .resizable() .frame(width: 40, height: 40) .background(.green) .cornerRadius(20) Text(helperName) } Spacer() Text(message.message) .padding() .background(Color.red) .foregroundColor(.black) .cornerRadius(10) .padding(.horizontal, 50) } Spacer() } } } }
}
struct ChatView_Previews: PreviewProvider { static var previews: some View { ChatView() } }
The text was updated successfully, but these errors were encountered:
会写跟他帮我写诗两回事来的,主要是我不会,LOL
Sorry, something went wrong.
https://platform.openai.com/ 进去注册不了怎么破?
@XiaBaKe 要爬楼梯,要外地号码卡,不过这些淘宝好似都可以做到
No branches or pull requests
struct ChatView: View {
let messages = [
ChatMessage(message: "Hello!", isMine: false),
ChatMessage(message: "Hi there!", isMine: true),
ChatMessage(message: "How are you?", isMine: false),
ChatMessage(message: "I'm doing well, thank you.", isMine: true),
ChatMessage(message: "That's great to hear!", isMine: false)
]
}
struct ChatView_Previews: PreviewProvider {
static var previews: some View {
ChatView()
}
}
The text was updated successfully, but these errors were encountered: