Skip to content
New issue

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

为什么不让他帮你写swiftUI? #1

Open
Liuqiang96 opened this issue Mar 30, 2023 · 3 comments
Open

为什么不让他帮你写swiftUI? #1

Liuqiang96 opened this issue Mar 30, 2023 · 3 comments

Comments

@Liuqiang96
Copy link

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()
}
}

@crazypoo
Copy link
Owner

会写跟他帮我写诗两回事来的,主要是我不会,LOL

@SamUncle
Copy link

https://platform.openai.com/ 进去注册不了怎么破?

@crazypoo
Copy link
Owner

@XiaBaKe 要爬楼梯,要外地号码卡,不过这些淘宝好似都可以做到

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants