Sets default names for skills and damage types to an empty string.

This commit is contained in:
2021-03-24 15:36:52 -07:00
parent 08fb3745c8
commit 06069e89ba
3 changed files with 4 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ class DamageTypeViewModel: ObservableObject, Comparable, Identifiable {
@Published var name: String @Published var name: String
init(_ name: String) { init(_ name: String = "") {
self.name = name self.name = name
} }
} }

View File

@@ -31,7 +31,7 @@ struct EditDamageTypes: View {
.toolbar(content: { .toolbar(content: {
Button( Button(
action: { action: {
let newDamageType = DamageTypeViewModel("New Type") let newDamageType = DamageTypeViewModel()
viewModel[keyPath: path].append(newDamageType) viewModel[keyPath: path].append(newDamageType)
viewModel[keyPath: path] = viewModel[keyPath: path].sorted() viewModel[keyPath: path] = viewModel[keyPath: path].sorted()
}, },

View File

@@ -25,7 +25,8 @@ struct EditSkills: View {
Button( Button(
action: { action: {
let newSkill = SkillViewModel() let newSkill = SkillViewModel()
newSkill.name = "New Skill" newSkill.name = ""
newSkill.proficiency = .proficient
monsterViewModel.skills.append(newSkill) monsterViewModel.skills.append(newSkill)
}, },
label: { label: {