Moves saving throws from EditMonster to a sub view.

This commit is contained in:
2021-03-21 14:47:15 -07:00
parent 5dee63fe54
commit 3a7125ee88
3 changed files with 100 additions and 61 deletions

79
EditSavingThrows.swift Normal file
View File

@@ -0,0 +1,79 @@
//
// EditSavingThrows.swift
// MonsterCards
//
// Created by Tom Hicks on 3/21/21.
//
import SwiftUI
struct EditSavingThrows: View {
@ObservedObject var monsterViewModel: MonsterViewModel
var body: some View {
List {
VStack {
MCAdvantagePicker(
label: "Strength Advantage",
value: $monsterViewModel.strengthSavingThrowAdvantage)
MCProficiencyPicker(
label: "Strength Proficiency",
value: $monsterViewModel.strengthSavingThrowProficiency)
}
VStack {
MCAdvantagePicker(
label: "Dexterity Advantage",
value: $monsterViewModel.dexteritySavingThrowAdvantage)
MCProficiencyPicker(
label: "Dexterity Proficiency",
value: $monsterViewModel.dexteritySavingThrowProficiency)
}
VStack {
MCAdvantagePicker(
label: "Constitution Advantage",
value: $monsterViewModel.constitutionSavingThrowAdvantage)
MCProficiencyPicker(
label: "Constitution Proficiency",
value: $monsterViewModel.constitutionSavingThrowProficiency)
}
VStack {
MCAdvantagePicker(
label: "Intelligence Advantage",
value: $monsterViewModel.intelligenceSavingThrowAdvantage)
MCProficiencyPicker(
label: "Intelligence Proficiency",
value: $monsterViewModel.intelligenceSavingThrowProficiency)
}
VStack {
MCAdvantagePicker(
label: "Wisdom Advantage",
value: $monsterViewModel.wisdomSavingThrowAdvantage)
MCProficiencyPicker(
label: "Wisdom Proficiency",
value: $monsterViewModel.wisdomSavingThrowProficiency)
}
VStack {
MCAdvantagePicker(
label: "Charisma Advantage",
value: $monsterViewModel.charismaSavingThrowAdvantage)
MCProficiencyPicker(
label: "Charisma Proficiency",
value: $monsterViewModel.charismaSavingThrowProficiency)
}
}
.textCase(nil)
}
}
struct EditSavingThrows_Previews: PreviewProvider {
static var previews: some View {
let viewModel = MonsterViewModel(nil)
EditSavingThrows(monsterViewModel: viewModel)
}
}