-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
What if I have a declaration of a struct like this?
struct Person {
var firstName: String = "Max"
var lastName: String = "Alexander"
var age: Int = 12
var phoneNumber: String = "4159300285"
}But then I try to construct it using:
let person: Person = try! construct(dictionary: [:])It'll tell me there are missing keys from the input dictionary. I understand the error. But what if the keys are missing and I prefer to construct it with their default values that I have declared above?
Is there any way to handle this sort of behavior?
Metadata
Metadata
Assignees
Labels
No labels