mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-11-21 12:30:50 +00:00
visionOS: use native toggles in menus
This commit is contained in:
parent
2ccef4e3a6
commit
fcb71f79ff
@ -66,15 +66,13 @@ struct SpeedButton: View {
|
|||||||
let label: LocalizedStringKey
|
let label: LocalizedStringKey
|
||||||
let speed: EmulatorSpeed
|
let speed: EmulatorSpeed
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if currentSpeed == speed {
|
Toggle(label, isOn: Binding(get: {
|
||||||
Button(label, systemImage: "checkmark") {}
|
currentSpeed == speed
|
||||||
} else {
|
}, set: { enable in
|
||||||
Button {
|
if enable {
|
||||||
currentSpeed = speed
|
currentSpeed = speed
|
||||||
} label: {
|
|
||||||
Text(label)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,22 +92,16 @@ struct MachineButton: View {
|
|||||||
@AppStorage("machine") var currentMachine: String = "Plus4M"
|
@AppStorage("machine") var currentMachine: String = "Plus4M"
|
||||||
var bundle: Bundle
|
var bundle: Bundle
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if currentMachine == bundle.name {
|
Toggle(isOn: Binding(get: {
|
||||||
Label {
|
currentMachine == bundle.name
|
||||||
Text("\(bundle.displayName ?? bundle.name)\n\(bundle.getInfoString ?? "")")
|
}, set: { enable in
|
||||||
} icon: {
|
if enable && !AppDelegate.emulator.anyDiskInserted {
|
||||||
Image(systemName: "checkmark")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Button {
|
|
||||||
if !AppDelegate.emulator.anyDiskInserted {
|
|
||||||
currentMachine = bundle.name
|
currentMachine = bundle.name
|
||||||
AppDelegate.shared.loadAndStartEmulator()
|
AppDelegate.shared.loadAndStartEmulator()
|
||||||
}
|
}
|
||||||
} label: {
|
}), label: {
|
||||||
Text("\(bundle.displayName ?? bundle.name)\n\(bundle.getInfoString ?? "")")
|
Text("\(bundle.displayName ?? bundle.name)\n\(bundle.getInfoString ?? "")")
|
||||||
}
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,17 +121,13 @@ struct DisplayScalingMenu: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Menu("Display Scaling", systemImage: "rectangle.and.text.magnifyingglass") {
|
Menu("Display Scaling", systemImage: "rectangle.and.text.magnifyingglass") {
|
||||||
ForEach(DisplayScalingMenu.filters, id: \.filter) { filter in
|
ForEach(DisplayScalingMenu.filters, id: \.filter) { filter in
|
||||||
if scalingFilter == filter.filter {
|
Toggle(filter.name, isOn: Binding(get: {
|
||||||
Label {
|
scalingFilter == filter.filter
|
||||||
Text(filter.name)
|
}, set: { enable in
|
||||||
} icon: {
|
if enable {
|
||||||
Image(systemName: "checkmark")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Button(filter.name) {
|
|
||||||
scalingFilter = filter.filter
|
scalingFilter = filter.filter
|
||||||
}
|
}
|
||||||
}
|
}))
|
||||||
}
|
}
|
||||||
}.menuOrder(.fixed)
|
}.menuOrder(.fixed)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user