Hello fellow Techies!
I am currently doing the Swift Playgrounds “Keep Going with Apps” on my iPad Pro. Everything has been going as designed until I got to the ‘Add and Delete Creatures‘ module. The lesson concludes with being able to add a creature to your list in the CreatureZoo. When you run the app from the playground, you can fill out the fields and tap ‘Add’ and that is when the app dims and after 5 seconds I get the notification that the app has an unknown crash. I have reviewed the lessons leading up to it, but I can’t find anything wrong. (Full Disclosure: I really have no clue what I am looking at some of time.)
Has anyone else ran into this?
`import SwiftUI
import Guide
struct CreatureEditor: View {
//#-learning-code-snippet(defineVariablesCreatureEditor)
//#-learning-code-snippet(environmentValue)
@State var newCreature : Creature = Creature(name: "", emoji: "")
@EnvironmentObject var data : CreatureZoo
@Environment(.dismiss) var dismiss
var body: some View {
SPCAssessableGroup(view: self) {
VStack(alignment: .leading) {
Form {
Section("Name") {
//#-learning-code-snippet(addACreatureEditorTextField)
TextField("What is your monster's name?", text: $newCreature.name)
}
Section("Emoji") {
TextField("What does your monster look like?", text: $newCreature.emoji)
}
Section("Creature Preview") {
CreatureRow(creature: newCreature)
}
}
}
.toolbar {
ToolbarItem {
Button("Add") {
data.creatures.append(newCreature)
dismiss()
}
}
}
//#-learning-code-snippet(addButtonToToolbar)
}
}
}
struct CreatureEditor_Previews: PreviewProvider {
static var previews: some View {
NavigationStack() {
CreatureEditor().environmentObject(CreatureZoo())
}
}
}’