@State var color:Color = Color.red
@Statevardate:Date=Date(timeIntervalSince1970:TimeInterval())
@Statevarselected:Settings.Storting= .id
var selecteSection:some View{
Section(header:Text("选项")) {
ColorPicker("颜色选择器", selection:$color)
Toggle(isOn:$settings.showEnglishName, label: {
Text("显示选择的颜色")
})
if settings.showEnglishName{
Text("")
.frame( maxWidth: .infinity,maxHeight: .infinity, alignment: .center)
.background(color)
}
DatePicker("时间选择器", selection:$date)
Toggle(isOn:$settings.showFavoriteOnly, label: {
Text("显示选择的时间")
})
if settings.showFavoriteOnly{
Text("时间:\(date.description)")
}
Picker(selection:$selected, label:Text("排序方式"), content: {
ForEach(Settings.Storting.allCases, id: \.self) { stortin
Text(stort.text).tag(stort.text)
}
})
}
}