Moves editing armor to a sub view of EditMonster.

This commit is contained in:
2021-03-21 14:22:30 -07:00
parent c3feaf4f64
commit c204a6baaf
3 changed files with 49 additions and 23 deletions

44
EditArmor.swift Normal file
View File

@@ -0,0 +1,44 @@
//
// EditArmor.swift
// MonsterCards
//
// Created by Tom Hicks on 3/21/21.
//
import SwiftUI
struct EditArmor: View {
@ObservedObject var monsterViewModel: MonsterViewModel
var body: some View {
List {
// Armor Type select bound to monster.armorTypeEnum
MCArmorTypePicker(
label: "Armor Type",
value: $monsterViewModel.armorType)
// Toggle bound to monster.hasShield?
Toggle(
"Has Shield",
isOn: $monsterViewModel.hasShield)
// Number with -/+ buttons bound to monster.naturalArmorBonus
MCStepperField(
label: "Natural Armor Bonus",
value: $monsterViewModel.naturalArmorBonus)
// Editable Text field bound to monster.customArmorText?
MCTextField(
label: "Custom Armor",
value: $monsterViewModel.customArmor)
}
.textCase(nil)
}
}
struct EditArmor_Previews: PreviewProvider {
static var previews: some View {
let viewModel = MonsterViewModel(nil)
EditArmor(monsterViewModel: viewModel)
}
}