SwiftUI - 在作为列表一部分的切换开关下添加描述
SwiftUI - Add description under a toggle switch that is part of a list
我想在列表项下方添加描述,类似于 Apple-like 列表。
我使用 Xcode 11 作为 iOS 13.2
NavigationView {
List {
Section(header: Text("Account information")){
Text(User.email)
VStack(alignment: .leading){
Toggle("Daily Digest", isOn: $dailyDigest)
Text("Receive a daily email with the events occurring on that day").font(.system(size: 10))
}
}
}.listStyle(GroupedListStyle()).navigationBarTitle("Settings")
}
拨动开关下面的描述,我希望它是这样的:
而不是
尝试使用 footer
:
NavigationView {
List {
Section(header: Text("Account information"),
footer: Text("Receive a daily email with the events occurring on that day")) { // <- add footer
Text("asd")
VStack(alignment: .leading) {
Toggle("Daily Digest", isOn: $dailyDigest)
}
}
}.listStyle(GroupedListStyle()).navigationBarTitle("Settings")
}
我想在列表项下方添加描述,类似于 Apple-like 列表。
我使用 Xcode 11 作为 iOS 13.2
NavigationView {
List {
Section(header: Text("Account information")){
Text(User.email)
VStack(alignment: .leading){
Toggle("Daily Digest", isOn: $dailyDigest)
Text("Receive a daily email with the events occurring on that day").font(.system(size: 10))
}
}
}.listStyle(GroupedListStyle()).navigationBarTitle("Settings")
}
拨动开关下面的描述,我希望它是这样的:
而不是
尝试使用 footer
:
NavigationView {
List {
Section(header: Text("Account information"),
footer: Text("Receive a daily email with the events occurring on that day")) { // <- add footer
Text("asd")
VStack(alignment: .leading) {
Toggle("Daily Digest", isOn: $dailyDigest)
}
}
}.listStyle(GroupedListStyle()).navigationBarTitle("Settings")
}