Hello,
I have an app that works out ETA, fuel consumption etc for a ship. After minimising the view, then maxmising the view, the date on the date picker does not update to the current time. Closing the app then opening it refreshes the date. It would be nice every time you open the view that the Date picker shows the current time and date. It only does this when you launch the app.
@State private var eTD = Date ()
DatePicker("ETD: ", selection: $eTD)
I tried this:
.onAppear() {
self.eTD = Date()
}
It works but Swift complains -
[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes
Any recommendations much appreciated!