import SwiftUI struct Message: Identifiable { let id = UUID(); let fromMe: Bool; let text: String } struct AssistantView: View { @State private var messages: [Message] = [ .init(fromMe: false, text: "Hi! I am Nova. What can I help you with today?"), .init(fromMe: true, text: "Help me plan a focused work week."), .init(fromMe: false, text: "Love it. Protect your mornings for deep work, batch meetings after lunch, and keep Fridays light.") ] private let chips = ["Plan my week", "Summarize this", "Write an email", "Brainstorm ideas"] var body: some View { ZStack { Color(red: 0.04, green: 0.06, blue: 0.05).ignoresSafeArea() VStack(spacing: 0) { HStack(spacing: 12) { Image(systemName: "sparkles").font(.title3).frame(width: 40, height: 40) .background(Color(red: 0.06, green: 0.64, blue: 0.5).opacity(0.2)).clipShape(Circle()) .foregroundColor(Color(red: 0.06, green: 0.64, blue: 0.5)) VStack(alignment: .leading) { Text("Nova").fontWeight(.bold).foregroundColor(.white) Text("● Online").font(.footnote).foregroundColor(Color(red: 0.06, green: 0.64, blue: 0.5)) } Spacer() }.padding() ScrollView { VStack(spacing: 12) { ForEach(messages) { m in HStack { if m.fromMe { Spacer() } Text(m.text) .padding(12) .background(m.fromMe ? Color(red: 0.06, green: 0.64, blue: 0.5) : Color.white.opacity(0.06)) .foregroundColor(m.fromMe ? .white : Color(white: 0.85)) .cornerRadius(18) if !m.fromMe { Spacer() } } } }.padding() } ScrollView(.horizontal, showsIndicators: false) { HStack { ForEach(chips, id: \.self) { chip in Button(chip) { messages.append(.init(fromMe: true, text: chip)) } .font(.footnote).padding(.vertical, 9).padding(.horizontal, 14) .background(Color.white.opacity(0.06)).foregroundColor(Color(red: 0.5, green: 0.85, blue: 0.75)) .cornerRadius(16) } }.padding(.horizontal) }.padding(.bottom, 8) } } } } #Preview { AssistantView() }