Sets default names for skills and damage types to an empty string.
This commit is contained in:
@@ -18,7 +18,7 @@ class DamageTypeViewModel: ObservableObject, Comparable, Identifiable {
|
||||
|
||||
@Published var name: String
|
||||
|
||||
init(_ name: String) {
|
||||
init(_ name: String = "") {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ struct EditDamageTypes: View {
|
||||
.toolbar(content: {
|
||||
Button(
|
||||
action: {
|
||||
let newDamageType = DamageTypeViewModel("New Type")
|
||||
let newDamageType = DamageTypeViewModel()
|
||||
viewModel[keyPath: path].append(newDamageType)
|
||||
viewModel[keyPath: path] = viewModel[keyPath: path].sorted()
|
||||
},
|
||||
|
||||
@@ -25,7 +25,8 @@ struct EditSkills: View {
|
||||
Button(
|
||||
action: {
|
||||
let newSkill = SkillViewModel()
|
||||
newSkill.name = "New Skill"
|
||||
newSkill.name = ""
|
||||
newSkill.proficiency = .proficient
|
||||
monsterViewModel.skills.append(newSkill)
|
||||
},
|
||||
label: {
|
||||
|
||||
Reference in New Issue
Block a user