// // AnnouncementsView.swift // Tusker // // Created by Shadowfacts on 4/17/24. // Copyright © 2024 Shadowfacts. All rights reserved. // import SwiftUI import Pachyderm struct AnnouncementsView: View { @ObservedObject var state: AnnouncementsCollection let mastodonController: MastodonController @Box var navigationDelegate: TuskerNavigationDelegate? init(announcements: AnnouncementsCollection, mastodonController: MastodonController, navigationDelegate: Box) { self.state = announcements self.mastodonController = mastodonController self._navigationDelegate = navigationDelegate } var body: some View { List { ForEach($state.announcements) { $announcement in AnnouncementListRow(announcement: $announcement, mastodonController: mastodonController, navigationDelegate: navigationDelegate) { withAnimation { state.announcements.removeAll(where: { $0.id == announcement.id }) } } } } .listStyle(.grouped) } } //#Preview { // AnnouncementsView() //}