GBA002/DeltaFeatures/Views/OptionPickerView.swift
Riley Testut ef47d78c64 [Features] Adds displayInline(_:) View modifier
Controls whether @Option detailView will be displayed inline in the Feature detail view in Delta’s settings, or as a full-screen view that’s pushed onto navigation stack when tapped.
2023-04-14 18:23:34 -05:00

30 lines
645 B
Swift

//
// OptionPickerView.swift
// Delta
//
// Created by Riley Testut on 4/10/23.
// Copyright © 2023 Riley Testut. All rights reserved.
//
import SwiftUI
// Type must be public, but not its properties.
public struct OptionPickerView<Value: LocalizedOptionValue>: View
{
var name: LocalizedStringKey
var options: [Value]
@Binding
var selectedValue: Value
public var body: some View {
Picker(name, selection: $selectedValue) {
ForEach(options, id: \.self) { value in
value.localizedDescription
}
}
.pickerStyle(.menu)
.displayInline()
}
}