Add button command, fix list selection
This commit is contained in:
@ -2,12 +2,20 @@ import SwiftUI
|
||||
|
||||
struct SettingsListView: View {
|
||||
|
||||
@Binding
|
||||
var selectedSection: SettingsSection
|
||||
@EnvironmentObject
|
||||
private var selection: SelectedContent
|
||||
|
||||
var body: some View {
|
||||
List(SettingsSection.allCases, selection: $selectedSection) { item in
|
||||
Label(item.rawValue, systemSymbol: item.icon).tag(item)
|
||||
List(SettingsSection.allCases) { section in
|
||||
Label(section.rawValue, systemSymbol: section.icon)
|
||||
.listRowBackground(RoundedRectangle(cornerRadius: 5)
|
||||
.fill(selection.section == section ? Color.blue : Color.clear)
|
||||
.padding(.horizontal, 10)
|
||||
)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
selection.section = section
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user