forked from MeloNX/MeloNX
Add Unselected Controller menu to Settings
This commit is contained in:
parent
3e657d7229
commit
06f3c6d20e
Binary file not shown.
@ -123,6 +123,33 @@ struct SettingsView: View {
|
|||||||
|
|
||||||
// Input Selector
|
// Input Selector
|
||||||
Section {
|
Section {
|
||||||
|
if !controllersList.filter({ !currentControllers.contains($0) }).isEmpty {
|
||||||
|
DisclosureGroup("Unselected Controllers") {
|
||||||
|
ForEach(controllersList.filter { !currentControllers.contains($0) }) { controller in
|
||||||
|
var customBinding: Binding<Bool> {
|
||||||
|
Binding(
|
||||||
|
get: { currentControllers.contains(controller) },
|
||||||
|
set: { bool in
|
||||||
|
if !bool {
|
||||||
|
currentControllers.removeAll(where: { $0.id == controller.id })
|
||||||
|
} else {
|
||||||
|
currentControllers.append(controller)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Toggle(isOn: customBinding) {
|
||||||
|
Text(controller.name)
|
||||||
|
.font(.body)
|
||||||
|
}
|
||||||
|
.tint(.blue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ForEach(controllersList) { controller in
|
ForEach(controllersList) { controller in
|
||||||
|
|
||||||
var customBinding: Binding<Bool> {
|
var customBinding: Binding<Bool> {
|
||||||
@ -154,15 +181,6 @@ struct SettingsView: View {
|
|||||||
Text("Player \(controller)")
|
Text("Player \(controller)")
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
Toggle(isOn: customBinding) {
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Text(controller.name)
|
|
||||||
.font(.body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.tint(.blue)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
} header: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user