Post

Replies

Boosts

Views

Activity

Reply to Update, Content, and Attachments on Vision Pro
Here's the code for DialogueView in case that's helpful: struct DialogueView: View { @EnvironmentObject var dialogueModel: DialogueViewModel var body: some View { VStack{ ScrollView{ ForEach(dialogueModel.messages.filter({$0.role != .system}), id: \.id){ message in messageView(message: message) Spacer() } } HStack{ TextField("Enter a message...", text: $dialogueModel.currentInput) Button{ dialogueModel.sendMessage() } label: { Text("Send") } } } .padding() } func messageView(message: Message) -> some View{ HStack{ if message.role == .user {Spacer()} Text(message.content) if message.role == .assistant {Spacer()} } } }
Aug ’24
Reply to Update, Content, and Attachments on Vision Pro
I need the view to update every time the index changes, but only once. The reason I try to check and re-set scene change is because I don't want it to re-render the same content every time update is called, since it's getting called when I enter messages in the attachment, and other times. Is it not an issue for the view to re-render every time update is called? (right now this means removing current scene images and adding the corresponding images for the 'new' scene) I'm not sure why update is called on a loop whenever I start to enter text into the dialogue view.
Aug ’24