Swiftui 在当前日期显示列表
在我的应用程序中,我有一个带有日期数组的列表视图,Swiftui 在当前日期显示列表,swiftui,Swiftui,在我的应用程序中,我有一个带有日期数组的列表视图,var calcWeights:[EggDay] struct EggDay: Identifiable { var id : Int var date : Date var weight : Double var measured : Bool var dailyLoss : Double init (id : Int, date: Date, weight : Double, measur
var calcWeights:[EggDay]
struct EggDay: Identifiable {
var id : Int
var date : Date
var weight : Double
var measured : Bool
var dailyLoss : Double
init (id : Int, date: Date, weight : Double, measured : Bool, dailyLoss : Double) {
self.id = id
self.date = date
self.weight = weight
self.measured = measured
self.dailyLoss = dailyLoss
}
}
它按日期排序,从第1天开始,如视图1所示。我想实现的是视图2。。。因此,清单应在当天提交
您想将列表滚动到今天还是只显示从今天开始的鸡蛋?用户必须能够滚动到第一天。所以我想把列表滚动到今天。只是为了方便用户。。。因此,用户可以立即选择当天。