TelemetryViewer icon indicating copy to clipboard operation
TelemetryViewer copied to clipboard

Show Favourites on Front Screen

Open winsmith opened this issue 4 years ago • 2 comments

  • [ ] Server: Allow Insights to be marked as favourites
  • [ ] Server: Get list of favourite insights
  • [ ] Client: Show Favourite insights on front screen

winsmith avatar Oct 07 '20 09:10 winsmith

Please let me know when you find a solution to this, I am facing a similar issue in Theatrical Trailers.

conath avatar Oct 15 '20 14:10 conath

This might be helpful: Programmatic navigation in SwiftUI NavigationView. In Theatrical Trailers, I solved this by selecting the first model item when the app loads.

In List.body:

let viewModel = data.enumerated().map { ListItem(data: $0.1, isSelected: $0.0 == 0) }
return NavigationView {
    ForEach(listItem) { item in
        ListRow(model: $item)
    }
}

Calculating the viewModel inside body might be problematic, however it is working fine so far. It could easily be moved e. g. to init.

In ListRow.body:

NavigationLink(destination: …, isActive: $model.isSelected)
    // views
}

conath avatar Oct 20 '20 22:10 conath