mirror of
https://github.com/yattee/yattee.git
synced 2024-11-15 02:28:23 +00:00
54915dcea1
- The order of the formats can now be changed in the Quality Settings. - sortingOrder is now part of QualitiyProfile. - bestPlayable is now part of PlayerBackend. - hls and stream aren't treated as unknown anymore.
45 lines
1.2 KiB
Swift
45 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct MultiselectRow: View {
|
|
let title: String
|
|
var selected: Bool
|
|
var disabled = false
|
|
var action: (Bool) -> Void
|
|
|
|
@State private var toggleChecked = false
|
|
|
|
var body: some View {
|
|
#if os(tvOS)
|
|
Button(action: { action(!selected) }) {
|
|
HStack {
|
|
Text(self.title)
|
|
Spacer()
|
|
if selected {
|
|
Image(systemName: "checkmark")
|
|
}
|
|
}
|
|
.contentShape(Rectangle())
|
|
}
|
|
.disabled(disabled)
|
|
#else
|
|
Toggle(title, isOn: $toggleChecked)
|
|
#if os(macOS)
|
|
.toggleStyle(.checkbox)
|
|
#endif
|
|
.onAppear {
|
|
guard !disabled else { return }
|
|
toggleChecked = selected
|
|
}
|
|
.onChange(of: toggleChecked) { new in
|
|
action(new)
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
|
|
struct MultiselectRow_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
MultiselectRow(title: "Title", selected: false) { _ in }
|
|
}
|
|
}
|