Adds skills display to the monster detail view.
This commit is contained in:
@@ -135,9 +135,9 @@
|
|||||||
E20209E625D8DEB600EFE733 /* Enums */ = {
|
E20209E625D8DEB600EFE733 /* Enums */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E20209E725D8DEC100EFE733 /* AbilityScore.swift */,
|
||||||
E20209F325D8E04300EFE733 /* AdvantageType.swift */,
|
E20209F325D8E04300EFE733 /* AdvantageType.swift */,
|
||||||
E20209F225D8E04300EFE733 /* ProficiencyType.swift */,
|
E20209F225D8E04300EFE733 /* ProficiencyType.swift */,
|
||||||
E20209E725D8DEC100EFE733 /* AbilityScore.swift */,
|
|
||||||
);
|
);
|
||||||
path = Enums;
|
path = Enums;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -207,27 +207,27 @@
|
|||||||
E2570FEB25B1ADA90055B23B /* Views */ = {
|
E2570FEB25B1ADA90055B23B /* Views */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E2CB0DB226080C0500142591 /* EditSkill.swift */,
|
E2570FF925B1AE020055B23B /* Collections.swift */,
|
||||||
E24ACE692607F715009BF703 /* EditSkills.swift */,
|
E2570FBA25B1AC520055B23B /* ContentView.swift */,
|
||||||
E24ACE642607F55D009BF703 /* EditSavingThrows.swift */,
|
E2570FF425B1ADEB0055B23B /* Dashboard.swift */,
|
||||||
E24ACE5F2607F45E009BF703 /* EditAbilityScores.swift */,
|
E24ACE5F2607F45E009BF703 /* EditAbilityScores.swift */,
|
||||||
E24ACE552607EE94009BF703 /* EditArmor.swift */,
|
E24ACE552607EE94009BF703 /* EditArmor.swift */,
|
||||||
E24ACE4F2607326E009BF703 /* EditBasicInfo.swift */,
|
E24ACE4F2607326E009BF703 /* EditBasicInfo.swift */,
|
||||||
E2570FBA25B1AC520055B23B /* ContentView.swift */,
|
|
||||||
E2570FEF25B1ADC10055B23B /* Search.swift */,
|
|
||||||
E2570FF425B1ADEB0055B23B /* Dashboard.swift */,
|
|
||||||
E2570FF925B1AE020055B23B /* Collections.swift */,
|
|
||||||
E2570FFE25B1AE180055B23B /* Library.swift */,
|
|
||||||
E257100325B1AF4A0055B23B /* SearchBar.swift */,
|
|
||||||
E257100825B1B2470055B23B /* MonsterDetail.swift */,
|
|
||||||
E2B5285825B3028700AAA69E /* EditMonster.swift */,
|
E2B5285825B3028700AAA69E /* EditMonster.swift */,
|
||||||
|
E24ACE642607F55D009BF703 /* EditSavingThrows.swift */,
|
||||||
|
E2CB0DB226080C0500142591 /* EditSkill.swift */,
|
||||||
|
E24ACE692607F715009BF703 /* EditSkills.swift */,
|
||||||
E24ACE5A2607F0F2009BF703 /* EditSpeed.swift */,
|
E24ACE5A2607F0F2009BF703 /* EditSpeed.swift */,
|
||||||
E210B83E25B42DAB0083EAC5 /* MCAdvantagePicker.swift */,
|
E2570FFE25B1AE180055B23B /* Library.swift */,
|
||||||
E2BD702B25B3A8D70058ED69 /* MCTextField.swift */,
|
|
||||||
E2BD703025B3BBB90058ED69 /* MCStepperField.swift */,
|
|
||||||
E210B83925B42D980083EAC5 /* MCProficiencyPicker.swift */,
|
|
||||||
E26CDA2A25CFB38E00E3F50D /* MCArmorTypePicker.swift */,
|
|
||||||
E2CB0DB726081A2F00142591 /* MCAbilityScorePicker.swift */,
|
E2CB0DB726081A2F00142591 /* MCAbilityScorePicker.swift */,
|
||||||
|
E210B83E25B42DAB0083EAC5 /* MCAdvantagePicker.swift */,
|
||||||
|
E26CDA2A25CFB38E00E3F50D /* MCArmorTypePicker.swift */,
|
||||||
|
E210B83925B42D980083EAC5 /* MCProficiencyPicker.swift */,
|
||||||
|
E2BD703025B3BBB90058ED69 /* MCStepperField.swift */,
|
||||||
|
E2BD702B25B3A8D70058ED69 /* MCTextField.swift */,
|
||||||
|
E257100825B1B2470055B23B /* MonsterDetail.swift */,
|
||||||
|
E2570FEF25B1ADC10055B23B /* Search.swift */,
|
||||||
|
E257100325B1AF4A0055B23B /* SearchBar.swift */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -235,11 +235,11 @@
|
|||||||
E257101225B1B2790055B23B /* Models */ = {
|
E257101225B1B2790055B23B /* Models */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E20209FA25D8E19100EFE733 /* MonsterViewModel.swift */,
|
|
||||||
E20209F925D8E19100EFE733 /* SkillViewModel.swift */,
|
|
||||||
E20209E625D8DEB600EFE733 /* Enums */,
|
E20209E625D8DEB600EFE733 /* Enums */,
|
||||||
E2182E6225B22F8A00DFAEF8 /* Monster+CoreDataClass.swift */,
|
E2182E6225B22F8A00DFAEF8 /* Monster+CoreDataClass.swift */,
|
||||||
|
E20209FA25D8E19100EFE733 /* MonsterViewModel.swift */,
|
||||||
E20209D225D8DD9600EFE733 /* Skill+CoreDataClass.swift */,
|
E20209D225D8DD9600EFE733 /* Skill+CoreDataClass.swift */,
|
||||||
|
E20209F925D8E19100EFE733 /* SkillViewModel.swift */,
|
||||||
);
|
);
|
||||||
path = Models;
|
path = Models;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|||||||
@@ -607,7 +607,14 @@ public class Monster: NSManagedObject {
|
|||||||
|
|
||||||
var skillsDescription: String {
|
var skillsDescription: String {
|
||||||
get {
|
get {
|
||||||
return ""
|
let sortedSkills = self.skillsArray.sorted {$0.name ?? "" < $1.name ?? ""}
|
||||||
|
return sortedSkills.reduce("") {
|
||||||
|
if $0 == "" {
|
||||||
|
return $1.skillDescription
|
||||||
|
} else {
|
||||||
|
return $0 + ", " + $1.skillDescription
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class Skill: NSManagedObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var wrappedProficiency: ProficiencyType {
|
var wrappedProficiency: ProficiencyType {
|
||||||
get {
|
get {
|
||||||
return ProficiencyType.init(rawValue: proficiency ?? "") ?? .none
|
return ProficiencyType.init(rawValue: proficiency ?? "") ?? .none
|
||||||
@@ -66,7 +65,11 @@ public class Skill: NSManagedObject {
|
|||||||
|
|
||||||
var skillDescription: String {
|
var skillDescription: String {
|
||||||
get {
|
get {
|
||||||
return String(format: "%@ %+d%@", name ?? "", modifier)
|
var advantageLabel = Monster.advantageLabelStringForType(wrappedAdvantage)
|
||||||
|
if (advantageLabel != "") {
|
||||||
|
advantageLabel = " " + advantageLabel
|
||||||
|
}
|
||||||
|
return String(format: "%@ %+d%@", name ?? "", modifier, advantageLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,14 @@ struct MonsterDetail: View {
|
|||||||
let savingThrowsDescription = monster.savingThrowsDescription
|
let savingThrowsDescription = monster.savingThrowsDescription
|
||||||
if (!savingThrowsDescription.isEmpty) {
|
if (!savingThrowsDescription.isEmpty) {
|
||||||
LabeledField("Saving Throws") {
|
LabeledField("Saving Throws") {
|
||||||
Text(monster.savingThrowsDescription)
|
Text(savingThrowsDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let skillsDescription = monster.skillsDescription
|
||||||
|
if (!skillsDescription.isEmpty) {
|
||||||
|
LabeledField("Skills") {
|
||||||
|
Text(skillsDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user