Created
May 2, 2024 03:36
-
-
Save apatronl/2adb0925ac47b4c34c2c77f45abfa7dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MainActor | |
struct ChatView: View { | |
@Bindable private var viewModel: ChatViewModel = ChatViewModel() | |
var body: some View { | |
NavigationStack { | |
VStack { | |
ChatMessagesList(viewModel: viewModel) | |
if viewModel.error != nil { | |
ErrorView() | |
} | |
HStack { | |
MessageTextField(draftMessage: $viewModel.draftMessage) | |
SendMessageButton { | |
Task { | |
await viewModel.sendMessage() | |
} | |
} | |
.disabled(!viewModel.canSendMessage) | |
} | |
.padding(8) | |
} | |
.navigationTitle("Gemini Chat") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment