Adds MCAbilityScorePicker.
This commit is contained in:
35
iOS/MonsterCards/Views/MCAbilityScorePicker.swift
Normal file
35
iOS/MonsterCards/Views/MCAbilityScorePicker.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// MCAbilityScorePicker.swift
|
||||
// MonsterCards
|
||||
//
|
||||
// Created by Tom Hicks on 2/15/21.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MCAbilityScorePicker: View {
|
||||
var label: String = ""
|
||||
var value: Binding<AbilityScore>
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Text(label)
|
||||
.font(.caption2)
|
||||
Picker(
|
||||
selection: value,
|
||||
label: Text(value.wrappedValue.displayName)) {
|
||||
ForEach(AbilityScore.allCases) {abilityScore in
|
||||
Text(abilityScore.displayName).tag(abilityScore)
|
||||
}
|
||||
}
|
||||
.pickerStyle(MenuPickerStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MCAbilityScorePicker_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MCAbilityScorePicker(
|
||||
label: "Ability Score",
|
||||
value: .constant(AbilityScore.strength))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user