'SwiftUI Variable Update Not Reflected in View

I'm more of a novice at Swift but am trying to make a 'Mark as read' sheet, where people can click an announcement, generated from an array of Announcement, open up a sheet to display the full notification message, then press the mark as read button that well marks that announcement as read. The announcements 'read' status is dictated by an exclamation image for unread notifications.

The problem is this read status isn't updating when you close the sheet (the exclamation image remains) and I'm unsure why.

Thanks

import SwiftUI

struct AnnouncementsView: View{
    @Binding var announcements: [Announcement]
    @State var displayedMessage: String = ""
    @State var isDisplayingMessage: Bool = false
    @State var displayedAnnouncement: Announcement = Announcement()
    
    static let sectionDateFormat: DateFormatter = {
        let formatter = DateFormatter()
        formatter.dateFormat = "dd/MM/YYYY"
        return formatter
    }()
    var body: some View{
        NavigationView{
            List($announcements){$announcement in
                Button(action: {
                    //displayedMessage = announcement.message
                    displayedAnnouncement = announcement
                    isDisplayingMessage = true
                }){
                    HStack{
                        if (!announcement.read){
                            Image(systemName: "exclamationmark.circle.fill")
                                .foregroundColor(.red)
                        }
                        Text(announcement.message)
                            .lineLimit(1)
                            .truncationMode(.tail)
                            .foregroundColor(.black)
                        Spacer()
                    }
                }
            }
            .listStyle(GroupedListStyle())
            .sheet(isPresented: $isDisplayingMessage){
                NavigationView{
                    AnnouncementView(announcement: $displayedAnnouncement)
                    .toolbar{
                        ToolbarItem(placement: .cancellationAction){
                            Button("Mark As Read"){
                                isDisplayingMessage = false
                                displayedAnnouncement.read = true
                            }
                        }
                    }
                }
            }
        }
    }
}

Edit: I think its because I then assign a singular announcement to the single source of truth displayedAnnouncement, so the update to .read doesn't propagate fully OR as the update is from a sheet still in the same view, the variable is updated correctly, but the View is not. Is there any way to force a View update if this is the case? If it is the former, I'm unsure how to display the .sheet with the appropriate announcement without using an assigned displayedAnnouncement variable as I have done.

I managed a work-around using a NavigationLink as opposed to using a .sheet, which does work as required although isn't quite the exact appearance/behaviour I'd like so I'd still be interested for any answers to this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source