I have a struct that is used when parsing JSON data. I want one of the fields, name, to be a fixed name, see below...
struct QuestionConfiguration: Codable, DisplayOrderable {
var name: String? = "QuestionConfiguration"
var isRequired: Bool
var displayOrder: Int
var title: String = ""
var questions: [Question]
}
Each time, when I then try and access a QuestionConfiguration object, name is nil.
I have tried using an init(), with parameters and without.
I have tried String? and String.
Does anyone know how I can achieve this so that name is the same for each object, without having to pass it to the object?